Multiple color plots / colorbars on a single axes
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
De Spiegeleer Alexandre
il 18 Ott 2019
Commentato: De Spiegeleer Alexandre
il 18 Ott 2019
Hi,
I am trying to make a tool to easily visualize outputs from a simulation.
With that in mind, I would like to be able to make slices in the 3D domain for various fields (e.g. velocity, current,...) and still provide flexibility for the user.
Currently, one can call a plot function that will create a figure and make a slice plot at the desired slices for one field:
uni.plot('newfigure','slice','yslice',0,'variable','jz','color','jet','colorposition','left')
where uni is an object of my class, and the various inputs parameters includ one that specifies the variable to plot (here, jz).
Let's call this plot, plot 1.
Now the user can make a second plot, plot 2 on top of the previous one
uni.plot('slice','zslice',0,'variable','ux','color','jet','colorposition','right')
For simplicity, I had decided to create a new axes for each new plot.
However, because the new axes of plot 2 appear on top of the one from plot 1, it does not look like they are plot on the same figure but on top of each other (obviously).
This can be seen in this figure:
To overcome that, I thought, let's just copy the slice from plot 2 into the axes from plot 1 using copyobj and then I can delete the plot that is on top.
This works to some extent but as you can see below, the second slice that was done (that was on top) is now merged in the first axes but its color automatically adapted to the colorbar of plot 1.
My question is then the following:
How to keep the second slice plot "attached" to its own colorbar?
Note that I cannot use the same colorbar because:
1) The variables are separated by several orders of magnitude
2) I would like the user to be able to specify the colormap for each plot they make.
If my approach is wrong, is there any alternative way to treat the problem I presented here?
Best,
Alexandre
0 Commenti
Risposta accettata
Bjorn Gustavsson
il 18 Ott 2019
There are some contributions on the file exchange that deals with this. I thik this is one: colormat-and-colorbar-utilities
You might find some others that suits your task better.
HTH
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Colormaps in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!