plotting 2 lines and one bar with 2 y-axes
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I'm trying to make a plot with two y-axes but three variables. So, on the first y-axis I want a line and a bar, and for the second y-axis just a line. I can't seem to figure this out with plotyy or plotyyy.
For a bar and line with plotyy I can use this code:
[ax,h1,h2] = plotyy(x1,y1,x2,y2,@bar,@line);
But this does not work with plotyyy:
[ax,hlines] = plotyyy(x1,y1,x2,y2,x3,y3,@bar,@line,@line);
Any suggestions would be greatly appreciated.
Thanks, Dan
0 commentaires
Réponse acceptée
Walter Roberson
le 12 Mar 2013
[ax,h1,h2] = plotyy(x1,y1,x3,y3,@bar,@line); %note x3 y3
hold(ax(1), 'on');
plot(ax(1), x2, y2); %on first axis
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Two y-axis 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!