How to align xaxis when using yyaxis

2 visualizaciones (últimos 30 días)
Nicolas
Nicolas el 14 de Nov. de 2016
Editada: dpb el 16 de Nov. de 2016
I would like to align the yaxis automatically of two plot when using yyaxis. Here's an example of the problem:
time = 0:1:10;
s=sawtooth(time);
v=-2:1:8;
yyaxis('left');
plot(time,s);
ylabel('s');
yyaxis('right');
plot(time,v);
ylabel('v');
When doing this, the y=0 of the left signal is align with the y=3 of the right signal in yaxis. How could it be both align on y=0? I still want to matlab to decide of the tick, min and max value of the yaxis, I just want the zeros to be align.
  1 comentario
dpb
dpb el 14 de Nov. de 2016
Editada: dpb el 16 de Nov. de 2016
Can't have Matlab be automagic in choosing the limits and still force the origin to be someplace specific--too many constraints with too few variables.
You'll have to do this by computing consistent ranges from those chosen and figure out what new scaling on ticks or ranges would be required to make the origins match up, sorry...
ADDENDUM What you were probably looking/wishing for is a property to set the origin location arbitrarily--unfortunately, the only property values yet implemented remain '[origin|bottom|top]' for y-axis and similarly for x. A general value isn't allowed.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Graphics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by