How do I make coloured scales from multiple graphs the same?
4 views (last 30 days)
Show older comments
My project is a 1 dimensional sediment transport model. My question is not about the model code. From the model I get 3D images and a scale (see attached photo). The scale is colour coded and I want the coloured scale for each graph to be the same no matter what the scales of the graph are. For example, I would like red to equal 80, even if one graph's scale is between 0 and 150 and another graph's scale is between 0 and 250. Thank you for considering my question :) I run R2015b.
I am a grad student working on a project in MATLAB. My abilities in MATLAB are very limited, the script and instructions on how to run the model were provided to me.
0 Comments
Accepted Answer
Kelly Kearney
on 22 Sep 2016
Just set the color axis limits to be the same on all of them:
ax(1) = subplot(2,2,1); % plot, etc.
ax(2) = subplot(2,2,2); % plot, etc.
set(ax, 'clim', [0 80]);
3 Comments
Kelly Kearney
on 22 Sep 2016
Aaaaaah!
I'm pretty sure plot-relevant stuff is actually in the generate_output script, not any of that code above.
Either attach that file, or cut-and-pase the relevant plotting-related stuff only.
If I had to take a blind guess, though, I'm going to guess that h is a figure handle, and the figure includes one of those subplots from your example image. In which case, add this after the call to generate_output.
hax = findall(h, 'type', 'axes');
set(hax, 'clim', [0 200]); % or whatever your preferred limits are
Unless of course the save-image-to-file step is also done in the generate_output script. In that case, you'll have to change the color limits before the saving is done.
More Answers (0)
See Also
Categories
Find more on Surface and Mesh Plots in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!