Plotting and reversing axis direction
Mostra commenti meno recenti
Hello, I want to plot a graph with one x axis and two y axes. I want one of the y axes to be reversed i.e. beginning at the top so the data hangs off the top of the graph. Additionally I want the reversed y axis plot to be a bar graph and the other to be an ordinary line plot.
I tried this function
plot (a,b)
bar(a,c)
Set (gca,'Ydir','reverse')
but this reversed both y axes.
Risposta accettata
Più risposte (1)
Walter Roberson
il 26 Nov 2011
2 voti
Consider using plotyy(), recording the axes generated, and applying the set() to the appropriate one.
3 Commenti
Maeve Ryan
il 26 Nov 2011
Walter Roberson
il 26 Nov 2011
ax = plotyy(...)
set(ax(2),'YDir','reverse')
Y Budi Sulistioadi
il 10 Giu 2013
this answer rocks! Thanks
Categorie
Scopri di più su 2-D and 3-D Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!