Closed
Description
Bug report
Bug summary
Previously working code using Matplotlib 2.2.3 now reports the following error in version 3.0.0.
Traceback (most recent call last):
File ".../contour_Matplotlib30.py", line 38, in <module>
contours = ax.contour(ts, rs, rms)
File ".../lib/python3.6/site-packages/mpl_toolkits/axes_grid1/parasite_axes.py", line 157, in contour
return self._contour(super().contour, *XYCL, **kwargs)
File ".../lib/python3.6/site-packages/mpl_toolkits/axes_grid1/parasite_axes.py", line 150, in _contour
cont = super_contour(self, gx, gy, *CL, **kwargs)
File ".../lib/python3.6/site-packages/matplotlib/__init__.py", line 1785, in inner
return func(ax, *args, **kwargs)
File ".../lib/python3.6/site-packages/matplotlib/axes/_axes.py", line 6209, in contour
contours = mcontour.QuadContourSet(self, *args, **kwargs)
File ".../lib/python3.6/site-packages/matplotlib/contour.py", line 887, in __init__
kwargs = self._process_args(*args, **kwargs)
File ".../lib/python3.6/site-packages/matplotlib/contour.py", line 1493, in _process_args
x, y, z = self._contour_args(args, kwargs)
File ".../lib/python3.6/site-packages/matplotlib/contour.py
7EBA
", line 1551, in _contour_args
x, y, z = self._check_xyz(args[:3], kwargs)
File ".../lib/python3.6/site-packages/matplotlib/contour.py", line 1580, in _check_xyz
x = np.asarray(x, dtype=np.float64)
File ".../lib/python3.6/site-packages/numpy/core/numeric.py", line 501, in asarray
return array(a, dtype, copy=False, order=order)
TypeError: float() argument must be a string or a number, not 'AxesParasiteParasiteAuxTrans'
The code below is an attempt to isolate the issue...
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.projections import PolarAxes
import mpl_toolkits.axisartist.floating_axes as FA
import mpl_toolkits.axisartist.grid_finder as GF
tr = PolarAxes.PolarTransform()
smin = 0
smax = 1
rlocs = np.arange(0.1, 1.0, 0.1)
tlocs = np.arccos(rlocs) # Conversion to polar angles
gl1 = GF.FixedLocator(tlocs) # Positions
tf1 = GF.DictFormatter(dict(zip(tlocs, map(str, rlocs))))
ghelper = FA.GridHelperCurveLinear(tr,
extremes=(0, np.pi / 2, # 1st quadrant
0, 1), #min and max of axis
grid_locator1=gl1,
tick_formatter1=tf1,
)
fig = plt.figure()
rect = 111
ax = FA.FloatingSubplot(fig, rect, grid_helper=ghelper)
ax.axis["right"].set_axis_direction("top")
ax.axis["left"].set_axis_direction("bottom")
ax.axis["top"].set_axis_direction("bottom")
ax.axis["bottom"].set_visible(False)
fig.add_subplot(ax)
ax = ax.get_aux_axes(tr)
rs, ts = np.meshgrid(np.linspace(smin, smax),np.linspace(0, np.pi / 2))
rms = np.cos(ts)
contours = ax.contour(ts, rs, rms)
plt.show()
Matplotlib version
- Operating system: Ubuntu 18.04
- Matplotlib version: 3.0.0 (not working), 2.2.3 (working)
- Matplotlib backend (
print(matplotlib.get_backend())
): module://backend_interagg - Python version: 3.6
If any of the above is not clear (apologies) leave a comment and I will try and provide more info.
If the above issue is expected with the major version upgrade it would be great if someone could point me in the direction of any documentation which would help me explain the issue.
Thanks in advance for any help.
Installed via conda (default)