Link ranges in a contour plot comparison

1 view (last 30 days)
Hello,
I am trying to link levels in 2 contour plots in one figure. As its easier to compare if the range/level is the same. Attached are two example figures and as you can see there are different ranges for each plot in a figure, which makes it difficult to compare.
I want to link them somehow so that the range for both plots in one figure are same. I hope I was able to explain my question fully.
Thanks, Mustahsan

Accepted Answer

Adam
Adam on 31 Oct 2014
Edited: Adam on 31 Oct 2014
hLink = linkprop( axesHandles, 'CLim' );
should work I think, if you create an array of the two axes handles in question.
doc linkprop
  2 Comments
Mustahsan Majeed
Mustahsan Majeed on 31 Oct 2014
Following is my code for the function for plotting the comparison. Could you please tell me how to use linkprops in this case:
function plot_cmp2(n_as,M_as,var_h,var_p,var)
var_h(var_h<min(level))=min(level);
var_h(var_h>max(level))=max(level);
var_p(var_p<min(level))=min(level);
var_p(var_p>max(level))=max(level);
h1=subplot(1,2,1)
[c,h1]=contourf(n_as,M_as,var_h);clabel(c,h1,'Color','w');colorbar('north')
label('Engine_speed [rpm]','Torque [Nm]','',[var ' HIL'])
set(gcf, 'Position', [100, 100,800, 500]);
h2=subplot(1,2,2)
[c,h2]=contourf(n_as,M_as,var_p);clabel(c,h2,'Color','w');colorbar('north')
label('Engine_speed [rpm]','Torque [Nm]','',[var ' AVL'])
set(gcf, 'Position', [100, 100,800, 500]);
end
Thanks, Mustahsan
Mustahsan Majeed
Mustahsan Majeed on 31 Oct 2014
I got it.
Thank you very much. It works now!

Sign in to comment.

More Answers (0)

Categories

Find more on Contour Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!