Conversation
xray/plot/plot.py
Outdated
There was a problem hiding this comment.
don't you want to use integer placeholders for python 2.6?
title.append('{0} = {1}'.format(key, value.values))|
@jhamman good idea 👍 |
|
@clarkfitzg - in your eyes, is this done? If so, I'll give it another look? |
|
@jhamman Yes, ready for review. |
xray/plot/plot.py
Outdated
There was a problem hiding this comment.
use iteritems from core.pycompat:
for dim, coord in iteritems(darray.coords):
...|
Will finish this up tomorrow morning. |
There was a problem hiding this comment.
Changes here make it easier to keep the function / methods consistent.
|
For interactive use, I think plotting squeezed data is probably what users want. But I worry that this will make the result of plotting functions less predictable. Maybe we should restrict squeezing the data to only the magic For axis titles, what happens if the data array has many scalar coordinates? Scalar coordinates can be directly assigned, not just created from indexing. My sense is that labelling facets will be more reliable if it is done explicitly in the same code that is doing the indexing/groupby. |
Works for me. The error message should be informative enough in the other cases. Scalar coordinates- this is the current behavior: So scalar coordinates do show up in the title, which is what I was going for. I could add a test for this.
That's the approach that I've moved to after spending more time on it. This PR adds the argument |
|
OK, seems pretty reasonable on the title then. Just note that some datasets (especially from model output) contain a lot of scalar variables, so that could easily get unwieldy. We might need to revisit this once it gets more use in the wild. For example, truncating the title at some reasonable line length might be a good idea. |
xray/core/dataarray.py
Outdated
There was a problem hiding this comment.
To me, this logic seems more appropriate for a helper function in the plotting module (closer to where it is called).
There was a problem hiding this comment.
Was waffling around where to put it. It's been in 3 different places over the course of this PR- here, in utils.py, and in the plot module. If you think the plot module is the best place then I'll put it there.
There was a problem hiding this comment.
This is fine -- it doesn't matter very much
|
feel free to merge |

Working on faceted plotting now. This will be helpful. It adds a title if the array came from a slice, and labels the colorbar with the variable name.