Multiple axis scales with contourf function

2 views (last 30 days)
As you can see in the following plot, I made an efficiency map of a hydraulic pump. The efficiency is related to the input torque and speed of the shaft (mechanical), but also to the pressure and flow of the output (hydraulic).
So the two plots are practicly the same. Is it possible for a contour plot to have 4 axis?
Two x-axis (my flow and speed) with two y-axis (my torque and pressure)
I have calculated the correlation, the only problem seems to be that the scaling of the two axis will be different.
For the plotting I used 5 matrices: Torque, Pressure, Flow, Speed, Efficiency
Then I plotted them with:
contourf(Q,P,Eff,'showtext','on','levelstepmode','manual','levelstep', 1)
contourf(N,T,Eff,'showtext','on','levelstepmode','manual','levelstep', 1)
  1 Comment
Patrik Ek
Patrik Ek on 6 Mar 2014
I guess nothing stops you from typing something like, 'T[Nm], P[bar]'. However, I would not recommend sharing axis here if it is not something that is always the same, because a plot like that would give such an impression. And if they are always the same I would rather show it once with 2 plots and then only show one property.

Sign in to comment.

Accepted Answer

Patrik Ek
Patrik Ek on 7 Mar 2014
Ok try this,
a = 1:5;
b = 2:2:10;
plot(a,b)
ax1 = gca;
ax2 = axes('Position',get(ax1,'Position'),'XAxisLocation','top',...¨
'YAxisLocation','right','Color','none','XColor','r','YColor','b');
When you are going to label the axis then, you have to give the correct handle for each axis (ax1 and ax2 in this case).

More Answers (0)

Community Treasure Hunt

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

Start Hunting!