Replace GridObject.show with GridObject.plot #142
Merged
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.
This commit follows the recent change to the StreamObject plotting interface (#130) by adding a
plot
method to GridObject that plots the object with imshow within the provided axes.This enables more composable plotting systems and plays nicely with the rest of the matplotlib interface. It can, however, make plotting quite verbose, especially when you need to add a colorbar (see theexcess topography and magicfunctions notebooks for some examples). I considered adding an option to add a colorbar to the plot function, wrapping up all of this axis divider stuff, but there are too many possible options that we would need to expose to make a nice interface.
This behavior was technically already available because GridObject is an array-like object, so it could be passed to imshow directly. This simply makes plotting more obvious. We should probably provide some examples of the array-like interface.
This also resolves #136 by using a logarithmic color scale for the flow accumulation raster.