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:
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
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?