-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
axhline/axvline broken with pint.Quantity #8910
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
Comments
Looks like this is because there's not a suitible converter stored in the Matplotlib unit registry: import matplotlib.pyplot as plt
import matplotlib.units as munits
import pint
units = pint.UnitRegistry()
for unit in munits.registry:
print(unit) prints
|
I don't have an example for the second one above handy at the moment. |
Hmm, I can't get those units to work with plot: import matplotlib.pyplot as plt
import pint
units = pint.UnitRegistry()
fig, ax = plt.subplots()
ax.plot([0 * units.meter, 1 * units.meter], [0 * units.meter, 1 * units.meter])
# ax.axhline(0 * units.meter)
plt.show() fails with
|
So it seems like calls to |
You can't use pint that way. You need to do: import matplotlib.pyplot as plt
import pint
units = pint.UnitRegistry()
fig, ax = plt.subplots()
ax.plot([0 , 1] * units.meter, [0, 1] * units.meter)
# ax.axhline(0 * units.meter)
plt.show() That works fine for me. Regarding |
See #4803 where I "fixed" the use of |
So it looks like only I'm of the opinion we should also be calling |
As a side note, even if this "bug" only produces the smallest change here, I am so putting in a new test to make sure the current, desired behavior is preserved. |
This tests that unit libraries that wrap arrays, like pint, work properly. This adds an image test that checks current behavior, which seems to be fully correct.
perhaps relim() should be triggering an autoscale_view()?
…On Thu, Aug 17, 2017 at 7:48 PM, Ryan May ***@***.***> wrote:
As a side note, even if this "bug" only produces the smallest change here,
I am *so* putting in a new test to make sure the current, desired
behavior is preserved.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#8910 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARy-Hl_4dq5xceIuWHNEk4p78Y3bHDRks5sZNEwgaJpZM4OcAEK>
.
|
I sense those were de-coupled for performance reasons. We could add a callback to |
This tests that unit libraries that wrap arrays, like pint, work properly. This adds an image test that checks current behavior, which seems to be fully correct.
Fixed with #9049. |
With matplotlib 2.0.2, you can't use pint.Quantity with
axhline
oraxvline
:yields:
The text was updated successfully, but these errors were encountered: