Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove quickplot unit label for time reference coordinates. Closes #615. #616

Merged
merged 1 commit into from
Jul 17, 2013

Conversation

ajdawson
Copy link
Member

This PR allows 1D plots in quickplot to omit the units part of the axis label when the coordinate it represents is given as a time reference, and hence will have been converted to an absolute date/time.

This change applies only to 1D plots because handling of time coordinates in 2D plots is not yet implemented, so the unit is still relevant there. This is the reason the implementation modifies _get_titles rather than _title.

@@ -100,8 +100,13 @@ def _label_with_points(cube, result=None, ndims=2, coords=None):
def _get_titles(u_object, v_object):
if u_object is None:
u_object = iplt._u_object_from_v_object(v_object)
xlabel = _title(u_object, with_units=True)
ylabel = _title(v_object, with_units=True)
try:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This try except confused me at first. I now realise it's because u_object can still be None despite line 102. Perhaps

xunits = u_object is not None and not u_object.units.is_time_reference()

is a little clearer, or just add a comment.

@pelson
Copy link
Member

pelson commented Jul 16, 2013

Really nicely put together PR with a comprehensive test to boot. Nice job @ajdawson. 👍

…iTools#615.

1D plots in quickplot omit the units part of the axis label when the
coordinate it represents is given as a time reference, and hence will
have been converted to an absolute date/time.
@ajdawson
Copy link
Member Author

@esc24 I used your suggestion to clarify the part where I determine if the x-axis should print a unit.

esc24 added a commit that referenced this pull request Jul 17, 2013
Remove quickplot unit label for time reference coordinates. Closes #615.
@esc24 esc24 merged commit 19584ad into SciTools:master Jul 17, 2013
@ajdawson ajdawson deleted the quickplot-time-units branch July 22, 2013 13:25
rcomer added a commit to rcomer/iris that referenced this pull request Oct 31, 2023
trexfeathers pushed a commit that referenced this pull request Nov 3, 2023
* Don't used mpl date2num

* removed units for time coords due to not matching autoticks

* update imagerepo.json

* Revert change from #616, as this is now handled within _title

* whatsnew

* update test data version

---------

Co-authored-by: alex chamberlain-clay <a.chamberlain-clay@metoffice.gov.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants