How to align xaxis when using yyaxis

2 vues (au cours des 30 derniers jours)
Nicolas
Nicolas le 14 Nov 2016
Modifié(e) : dpb le 16 Nov 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 commentaire
dpb
dpb le 14 Nov 2016
Modifié(e) : dpb le 16 Nov 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.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Graphics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by