Multiple contour plots with one colorbar
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mepe
am 3 Jun. 2020
Kommentiert: Mepe
am 5 Jun. 2020
I have three contourf plots in a figure, each with a separate colorbar. Since the colorbars are identical for all plots, I would like to have only one that goes over the entire height of the figure.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/309452/image.png)
Anyone have an idea?
0 Kommentare
Akzeptierte Antwort
Constantino Carlos Reyes-Aldasoro
am 4 Jun. 2020
Hello
I think you have asked a similar question, or at least the answer is similar and it is to use the handles of each element of the figure, for instance this will create three plots:
h0=figure(1);
h1=subplot(311);imagesc(randn(25));h11=colorbar;
h2=subplot(312);imagesc(randn(25));h12=colorbar;
h3=subplot(313);imagesc(randn(25));h13=colorbar;
Now you can control each of those objects, let's make two colorbar invisibles, and then change the size of the other colorbar
h11.Visible = 'off';
h13.Visible = 'off';
h1.Position = [ 0.1300 0.7093 0.67 0.2157];
h2.Position = [ 0.1300 0.4096 0.67 0.2157];
h3.Position = [ 0.1300 0.1100 0.67 0.2157];
h12.Position =[ 0.8190 0.10 0.0381 0.83];
Notice that I also controlled the position of the axes. Perhaps the actual values will not exactly match your figure, but just play a little with those numbers and it should work.
As before, if this answers your question, please accept, if it does not, let me know.
2 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Colormaps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!