Problem using semilogx plot command

62 visualizaciones (últimos 30 días)
HenryatNU
HenryatNU el 17 de Jun. de 2016
Comentada: Siva el 25 de Feb. de 2025
I have a script with several semilogx plots -on OSX10.11.5 with R2016a. They work fine except for the very last one. Instead of a log scale for the x-axis it produces a linear one. I can see no difference in it at all from the others. I copy below first one of the good ones then the bad one;
GOOD -log plot: semilogx(ipTotal,alt,'-k')
NotGOOD-gives linear x-axis: semilogx(e_total(20:61),alt(20:61),'-k')
I am baffled by this one. Could there be some hidden special character or something?
Any suggestions greatly appreciated...
SOLVED:
I just figured it out. I had put a "hold on" before the semilogx - my bad.
When I rearranged it everything worked fine. Clue came when I tried the same semilogx in the interactive terminal and got the semilog plot, so I knew it had to be something I had done in the script.
Thanks for the comments. They helped me take another good look at what I had done...
  3 comentarios
dpb
dpb el 18 de Jun. de 2016
Mayhaps the data have negative values so couldn't do log? Don't have the new graphics engine here so not sure what it would do in such case...
Siva
Siva el 25 de Feb. de 2025
can you post the rearranged code?

Iniciar sesión para comentar.

Respuestas (1)

Dennis Dunn
Dennis Dunn el 2 de Feb. de 2018
I still have the same problem you did, except I called "hold on" before making individual semilogx calls. Each plot is together on the same graph, but the only way I can get the log scale to show up is to call:
set(gca, 'XScale', 'log');
  1 comentario
dpb
dpb el 2 de Feb. de 2018
Release/OS?
Can you post a runable example that duplicates the problem?

Iniciar sesión para comentar.

Categorías

Más información sobre Creating, Deleting, and Querying Graphics Objects en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by