How to plot graph with three axsis (an example figure is included )
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi
I have three variables and would like to plot them as in the following figure which was produced in Excel.
The Red curve is plot by x,y axis (time vs rho). the blue curve is plotted by x,z axis (N vs rho) the yellow curve is plotted by x,z axis (N vs rho)
Thanks in advance.
0 comentarios
Respuestas (5)
dpb
el 3 de Jul. de 2014
...not sure what is the mistake I am doing. As you can see in the figure that the legend does not reflect the curves colors.
Don't plot the same stuff multiple times...you've thoroughly confused legend by having multiple lines of the same stuff.
A) Plot the data on the axes desired...
[hax hl1 hl2] = plotyy(rho,time,rho,[avg_n max_n],'semilogy','plot');
B) Then fixup the line handles to the desired properties...
set(hl1,'MarkerFaceColor',[0 0.498039215803146 0],...
'MarkerEdgeColor',[0 0.498039215803146 0],...
'Marker','>',...
'Color',[0 0.498039215803146 0],'MarkerSize',5,'LineWidth',2)
and so on for the two on the RH axis using hl2(1) and hl2(2)
Then legend will have only the three needed lines, not two or three copies of each.
Bander
el 4 de Jul. de 2014
2 comentarios
Image Analyst
el 4 de Jul. de 2014
Editada: Image Analyst
el 4 de Jul. de 2014
You've had 4 answers already. Did you overlook them?
dpb
el 4 de Jul. de 2014
The revised one you posted looks ok to me...whatever it was that was the typo that created the error is/would be readily fixable; in fact, it looks like that's precisely what you did to generate the figure.
What, specifically, is wrong with it?
Ver también
Categorías
Más información sobre Two y-axis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!