-
Notifications
You must be signed in to change notification settings - Fork 286
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
Quickplot Automatic Time Axis Label Completely Incorrect #5426
Comments
You are right. It is hard-coded here: Lines 50 to 56 in 8361532
and I agree that specifying the units like this is misleading. Note that if you zoom in enough on your plot, you will no longer see years but Matplotlib automatically starts showing the dates in YYYY-MM-DD format. I do not think there is an easy way to make the label reflect that. So maybe it would be best to just not specify a unit here, which is what happens if you make a line plot rather than a pcolormesh: import iris
import iris.quickplot as qplt
cube = iris.load_cube("sst_example.nc")
qplt.plot(cube[:, 0, 0]) |
#616 removed the unit for the 1D plots. I guess something else developed in the meantime to make the 2D plot ticks use Matplotlib’s date formatter, but the label has not been updated to match. |
🐛 Bug Report
The automatic quickplot time label is unrelated to the printed time ticks and even to native cube units
Minimum Reproducible Code
Any spatio-temporal cube will do; I've saved an example of Pacific SST from a pre-Industrial control run using years 1191-1200, attached it below (be sure to remove
.txt
from the name):sst_example.nc.txt
Expected behaviour
The native units of the cube
m_ex
aredays since 1850-1-1 00:00:00
(see printed output in the screenshot below), and the values are incredibly large negative numbers (the largest time value is-237266.5
). However, I do not expect to see tick labels in days relative to some offset, but in absolute time presented in years, ranging from 1191 to 1200. I thus expect the time axis to be labelledYear
, orTime / Year
Observed behavior
The time ticks appear as expected, as all are between 1191 and 1200. However, the automatic label says
Time / days since 1970-01-01
. This is clearly not consistent with the time ticks because the presented numbers of in units of years with no time offset. Furthermore, t's completely unclear where the offset in the label came from, since the native offset of the cube being plotted (m_ex
) is1850
. I wonder if these units have been hard-coded somewhere?The text was updated successfully, but these errors were encountered: