WIP: Properly set pobj and don't make colorbar if this is None #219
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I was seeing strange behavior in GeoClaw plots in Python3, that sometimes the colorbar showed up all green (from the land plots) rather than showing the colorbar for the ocean plot, even though that was the only one requested.
Also when plotting data that was entirely masked on all patches, the gauge was plotted where the colorbar should have been.
I figured out there was a problem in how
exec
was used that meantpobj
wasn't getting set at all. Moreoverexec
andcolorbar
both work differently in Python3.I've rewritten the way
pobj
is set when calling thepcolor
function for this particularplot_type
, to put all the arguments intokwargs
(rather than constructing a stringpcolor_cmd
and then usingexec
).I suggest we might want to do the same for all other
plot_types
and I'll work on that unless anyone has a better idea how to do this.I also modified the code so that if
pobj
ends up asNone
, meaning all patches were masked, then it does not make a colorbar. But then the main plot ends up bigger than it would otherwise, unpleasant in an animation with other frames. I think we might want to rewrite all the colorbar stuff to usecolorbar.make_axes_gridspec
to always make the colorbar axes, and probably we should make it easier for the user to specify other attributes of colorbars (e.g. location, orientation).