You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "test.py", line 6, in <module>
ax.plot([0 * units.meter, 1 * units.meter], [0 * units.meter, 1 * units.meter])
File "/Users/dstansby/matplotlib/lib/matplotlib/__init__.py", line 1754, in inner
return func(ax, *args, **kwargs)
File "/Users/dstansby/matplotlib/lib/matplotlib/axes/_axes.py", line 1435, in plot
for line in self._get_lines(*args, **kwargs):
File "/Users/dstansby/matplotlib/lib/matplotlib/axes/_base.py", line 404, in _grab_next_args
for seg in self._plot_args(this, kwargs):
File "/Users/dstansby/matplotlib/lib/matplotlib/axes/_base.py", line 379, in _plot_args
x = _check_1d(tup[0])
File "/Users/dstansby/matplotlib/lib/matplotlib/cbook/__init__.py", line 1972, in _check_1d
return np.atleast_1d(x)
File "/Users/dstansby/miniconda3/lib/python3.6/site-packages/numpy/core/shape_base.py", line 52, in atleast_1d
ary = asanyarray(ary)
File "/Users/dstansby/miniconda3/lib/python3.6/site-packages/numpy/core/numeric.py", line 583, in asanyarray
return array(a, dtype, copy=False, order=order, subok=True)
ValueError: setting an array element with a sequence.
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.
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 Axes (say, _on_units_changed) that calls both relim() and autoscale_view(), replacing the existing direct connection to relim`. Thoughts?
Activity
dstansby commentedon Jul 31, 2017
Looks like this is because there's not a suitible converter stored in the Matplotlib unit registry:
prints
dopplershift commentedon Jul 31, 2017
plotI don't have an example for the second one above handy at the moment.
dstansby commentedon Aug 8, 2017
Hmm, I can't get those units to work with plot:
fails with
dstansby commentedon Aug 8, 2017
So it seems like calls to
atleast_1din our codebase means that pint.Units won't work?dopplershift commentedon Aug 8, 2017
You can't use pint that way. You need to do:
That works fine for me.
Regarding
atleast_1d, that's correct, they completely annihilate anything that's not a subclass of ndarray.dopplershift commentedon Aug 8, 2017
See #4803 where I "fixed" the use of
atleast_1dforplot.dopplershift commentedon Aug 17, 2017
Well, it seems that things are better than I last checked when implementing a proper converter, at least with master:
Produces:

Once you add

ax.autoscale_view()you get:Which is actually correct. Now the question is why the autoscale doesn't kick off.
dopplershift commentedon Aug 17, 2017
So it looks like only
relim()is called when units change, which only refreshes the data limits, not the view limits.I'm of the opinion we should also be calling
autoscale_viewwhen units change, what do others think?dopplershift commentedon Aug 17, 2017
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.
TST: Add test for pint (and alike) behavior (matplotlib#8910)
WeatherGod commentedon Aug 21, 2017
dopplershift commentedon Aug 22, 2017
I sense those were de-coupled for performance reasons. We could add a callback to
Axes(say,_on_units_changed) that calls bothrelim()andautoscale_view(), replacing the existing direct connection torelim`. Thoughts?TST: Add test for pint (and alike) behavior (matplotlib#8910)
dopplershift commentedon Aug 29, 2017
Fixed with #9049.