matplotlib gives a ValueError: could not convert string to float: - python

I have a pandas DataFrame. The columns, head and dtypes are as shown below:
print sorted_results.dtypes
print sorted_results[['coefficients']].head()
0 object
coefficients float64
dtype: object
coefficients
62 2.432853
70 2.187059
19 1.804636
68 1.507075
130 1.120488
I want to plot a barchart using matplot lib, so
plt.barh(range(len(sorted_results)), sorted_results[['coefficients']])
gives the following:
ValueError Traceback (most recent call last)
<ipython-input-17-1d344a50d686> in <module>()
1
----> 2 plt.barh(range(len(sorted_results)), sorted_results[['coefficients']])
/Users/sram/anaconda/lib/python2.7/site-packages/matplotlib/pyplot.pyc in barh(bottom, width, height, left, hold, **kwargs)
2665 ax.hold(hold)
2666 try:
-> 2667 ret = ax.barh(bottom, width, height=height, left=left, **kwargs)
2668 finally:
2669 ax.hold(washold)
/Users/sram/anaconda/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in barh(self, bottom, width, height, left, **kwargs)
2245
2246 patches = self.bar(left=left, height=height, width=width,
-> 2247 bottom=bottom, orientation='horizontal', **kwargs)
2248 return patches
2249
/Users/sram/anaconda/lib/python2.7/site-packages/matplotlib/__init__.pyc in inner(ax, *args, **kwargs)
1817 warnings.warn(msg % (label_namer, func.__name__),
1818 RuntimeWarning, stacklevel=2)
-> 1819 return func(ax, *args, **kwargs)
1820 pre_doc = inner.__doc__
1821 if pre_doc is None:
/Users/sram/anaconda/lib/python2.7/site-packages/matplotlib/axes/_axes.pyc in bar(self, left, height, width, bottom, **kwargs)
2085 edgecolor=e,
2086 linewidth=lw,
-> 2087 label='_nolegend_'
2088 )
2089 r.update(kwargs)
/Users/sram/anaconda/lib/python2.7/site-packages/matplotlib/patches.pyc in __init__(self, xy, width, height, angle, **kwargs)
640 self._x = float(xy[0])
641 self._y = float(xy[1])
--> 642 self._width = float(width)
643 self._height = float(height)
644 self._angle = float(angle)
ValueError: could not convert string to float: coefficients
Coefficients seems to have the right datatype. I'm stumped by why I am doing wrong here

Related

How to convert auxiliary coordinates to dimension coordinates in a cube in iris?

I am pretty new to using NetCDF Jules output files. I am trying to write a routine to create multiple plots visualising the output from my simulations.
After reading in the cubes I have the following format:
filename = '/home/users/---------.nc'
cubelist = iris.load(filename)
cons = iris.Constraint(cube_func=lambda x: x.var_name == 'gpp_gb')
cube = cubelist.extract_cube(cons)
print (cube)
type(cube)
print (cube.shape)
print (cube.ndim)
first_timestep = cube[0,...]
print (first_timestep)
output:
Gridbox gross primary productivity / (kg m-2 s-1) (time: 12; -- : 1; -- : 7247)
Dimension coordinates:
time x - -
Auxiliary coordinates:
latitude - x x
longitude - x x
Cell methods:
mean time
(12, 1, 7247)
3
Gridbox gross primary productivity / (kg m-2 s-1) (-- : 1; -- : 7247)
Auxiliary coordinates:
latitude x x
longitude x x
Scalar coordinates:
time 2009-02-01 00:00:00, bound=(2009-01-01 00:00:00, 2009-02-01 00:00:00)
Cell methods:
mean time
However when i try to map the data with:
qplt.contourf(first_timestep, 50)
I get the following error message:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/tmp/ipykernel_2386/1836137079.py in <module>
16
17
---> 18 qplt.contourf(first_timestep, 50)
/opt/jaspy/lib/python3.8/site-packages/iris/quickplot.py in contourf(cube, *args, **kwargs)
206 coords = kwargs.get("coords")
207 axes = kwargs.get("axes")
--> 208 result = iplt.contourf(cube, *args, **kwargs)
209 _label_with_points(cube, result, coords=coords, axes=axes)
210 return result
/opt/jaspy/lib/python3.8/site-packages/iris/plot.py in contourf(cube, *args, **kwargs)
1057 coords = kwargs.get("coords")
1058 kwargs.setdefault("antialiased", True)
-> 1059 result = _draw_2d_from_points("contourf", None, cube, *args, **kwargs)
1060
1061 # Matplotlib produces visible seams between anti-aliased polygons.
/opt/jaspy/lib/python3.8/site-packages/iris/plot.py in _draw_2d_from_points(draw_method_name, arg_func, cube, *args, **kwargs)
495
496 if _can_draw_map(plot_defn.coords):
--> 497 result = _map_common(
498 draw_method_name,
499 arg_func,
/opt/jaspy/lib/python3.8/site-packages/iris/plot.py in _map_common(draw_method_name, arg_func, mode, cube, plot_defn, *args, **kwargs)
1007 axes = kwargs.pop("axes", None)
1008 plotfn = getattr(axes if axes else plt, draw_method_name)
-> 1009 return plotfn(*new_args, **kwargs)
1010
1011
/opt/jaspy/lib/python3.8/site-packages/matplotlib/pyplot.py in contourf(data, *args, **kwargs)
2743 #_copy_docstring_and_deprecators(Axes.contourf)
2744 def contourf(*args, data=None, **kwargs):
-> 2745 __ret = gca().contourf(
2746 *args, **({"data": data} if data is not None else {}),
2747 **kwargs)
/opt/jaspy/lib/python3.8/site-packages/cartopy/mpl/geoaxes.py in wrapper(self, *args, **kwargs)
308
309 kwargs['transform'] = transform
--> 310 return func(self, *args, **kwargs)
311 return wrapper
312
/opt/jaspy/lib/python3.8/site-packages/cartopy/mpl/geoaxes.py in contourf(self, *args, **kwargs)
1506 sub_trans.force_path_ccw = True
1507
-> 1508 result = matplotlib.axes.Axes.contourf(self, *args, **kwargs)
1509
1510 # We need to compute the dataLim correctly for contours.
/opt/jaspy/lib/python3.8/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
1359 def inner(ax, *args, data=None, **kwargs):
1360 if data is None:
-> 1361 return func(ax, *map(sanitize_sequence, args), **kwargs)
1362
1363 bound = new_sig.bind(ax, *args, **kwargs)
/opt/jaspy/lib/python3.8/site-packages/matplotlib/axes/_axes.py in contourf(self, *args, **kwargs)
6432 def contourf(self, *args, **kwargs):
6433 kwargs['filled'] = True
-> 6434 contours = mcontour.QuadContourSet(self, *args, **kwargs)
6435 self._request_autoscale_view()
6436 return contours
/opt/jaspy/lib/python3.8/site-packages/matplotlib/contour.py in __init__(self, ax, levels, filled, linewidths, linestyles, hatches, alpha, origin, extent, cmap, colors, norm, vmin, vmax, extend, antialiased, nchunk, locator, transform, *args, **kwargs)
775 self._transform = transform
776
--> 777 kwargs = self._process_args(*args, **kwargs)
778 self._process_levels()
779
/opt/jaspy/lib/python3.8/site-packages/matplotlib/contour.py in _process_args(self, corner_mask, *args, **kwargs)
1364 self._corner_mask = corner_mask
1365
-> 1366 x, y, z = self._contour_args(args, kwargs)
1367
1368 _mask = ma.getmask(z)
/opt/jaspy/lib/python3.8/site-packages/matplotlib/contour.py in _contour_args(self, args, kwargs)
1422 args = args[1:]
1423 elif Nargs <= 4:
-> 1424 x, y, z = self._check_xyz(args[:3], kwargs)
1425 args = args[3:]
1426 else:
/opt/jaspy/lib/python3.8/site-packages/matplotlib/contour.py in _check_xyz(self, args, kwargs)
1452 raise TypeError(f"Input z must be 2D, not {z.ndim}D")
1453 if z.shape[0] < 2 or z.shape[1] < 2:
-> 1454 raise TypeError(f"Input z must be at least a (2, 2) shaped array, "
1455 f"but has shape {z.shape}")
1456 Ny, Nx = z.shape
TypeError: Input z must be at least a (2, 2) shaped array, but has shape (1, 7247)
I think it could be because my coordinate data is not in a format the iris package can understand as it is in the auxiliary fields when i print the cube. I think the code should work if I could put the latitude and longitude data into the dimension coordinates. Any help or ideas would be much appreciated.
Thank you for considering the problem.
some functions to which helped my specific problem.
https://code.metoffice.gov.uk/trac/utils/browser/smstress_jpeg/trunk/jules.py#L629

What does it mean to have a TypeError: float() argument must be a string or a number, not 'pandas._libs.interval.Interval'?

I made this function to find the distribution of all the columns in my pandas dataframe and it works when I have each individual line in separate cells, but when I put it into this one function I get the error message
TypeError: float() argument must be a string or a number, not 'pandas._libs.interval.Interval'
I'm relatively new to coding so I don't know what that means or how to fix it. Please help! thank you
def function():
for x in range(df.shape[1]):
columns = df.columns
if len(df[columns[x]].unique()) > 10:
samp = pd.qcut(df[columns[x]], 4)
bins = samp.unique
sampdf = pd.DataFrame(samp)
ex1 = sampdf.groupby(columns[x]).agg({columns[x]:'count'})
ex2 = ex1.reset_index(drop=True)`
else:
samp = df[columns[x]]
sampdf = pd.DataFrame(samp)
ex1 = sampdf.groupby(columns[x]).agg({columns[x]:'count'})
plt.style.use('ggplot')
plt.bar(ex1.index, ex1[columns[x]], color= 'purple')
plt.ylabel('Customers')
plt.xlabel(columns[x])
plt.title('Distribution of ' + columns[x])
plt.show()
The Traceback was:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-28-c0b3cafe2087> in <module>
----> 1 function1()
<ipython-input-27-bcfb6d749f86> in function1()
15
16 plt.style.use('ggplot')
---> 17 plt.bar(ex1.index, ex1[columns[0]], color= 'purple')
18 plt.ylabel('Customers')
19 plt.xlabel(columns[0])
/opt/anaconda3/lib/python3.8/site-packages/matplotlib/pyplot.py in bar(x, height, width, bottom, align, data, **kwargs)
2485 x, height, width=0.8, bottom=None, *, align='center',
2486 data=None, **kwargs):
-> 2487 return gca().bar(
2488 x, height, width=width, bottom=bottom, align=align,
2489 **({"data": data} if data is not None else {}), **kwargs)
/opt/anaconda3/lib/python3.8/site-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
1436 def inner(ax, *args, data=None, **kwargs):
1437 if data is None:
-> 1438 return func(ax, *map(sanitize_sequence, args), **kwargs)
1439
1440 bound = new_sig.bind(ax, *args, **kwargs)
/opt/anaconda3/lib/python3.8/site-packages/matplotlib/axes/_axes.py in bar(self, x, height, width, bottom, align, **kwargs)
2492 elif orientation == 'horizontal':
2493 r.sticky_edges.x.append(l)
-> 2494 self.add_patch(r)
2495 patches.append(r)
2496
/opt/anaconda3/lib/python3.8/site-packages/matplotlib/axes/_base.py in add_patch(self, p)
2031 if p.get_clip_path() is None:
2032 p.set_clip_path(self.patch)
-> 2033 self._update_patch_limits(p)
2034 self.patches.append(p)
2035 p._remove_method = self.patches.remove
/opt/anaconda3/lib/python3.8/site-packages/matplotlib/axes/_base.py in _update_patch_limits(self, patch)
2051 vertices = patch.get_path().vertices
2052 if vertices.size > 0:
-> 2053 xys = patch.get_patch_transform().transform(vertices)
2054 if patch.get_data_transform() != self.transData:
2055 patch_to_data = (patch.get_data_transform() -
/opt/anaconda3/lib/python3.8/site-packages/matplotlib/patches.py in get_patch_transform(self)
790
791 def get_patch_transform(self):
--> 792 self._update_patch_transform()
793 return self._rect_transform
794
/opt/anaconda3/lib/python3.8/site-packages/matplotlib/patches.py in _update_patch_transform(self)
769 """
770 x0, y0, x1, y1 = self._convert_units()
--> 771 bbox = transforms.Bbox.from_extents(x0, y0, x1, y1)
772 rot_trans = transforms.Affine2D()
773 rot_trans.rotate_deg_around(x0, y0, self.angle)
/opt/anaconda3/lib/python3.8/site-packages/matplotlib/transforms.py in from_extents(*args)
820 The *y*-axis increases upwards.
821 """
--> 822 return Bbox(np.reshape(args, (2, 2)))
823
824 def __format__(self, fmt):
/opt/anaconda3/lib/python3.8/site-packages/matplotlib/transforms.py in __init__(self, points, **kwargs)
772 """
773 BboxBase.__init__(self, **kwargs)
--> 774 points = np.asarray(points, float)
775 if points.shape != (2, 2):
776 raise ValueError('Bbox points must be of the form '
/opt/anaconda3/lib/python3.8/site-packages/numpy/core/_asarray.py in asarray(a, dtype, order)
81
82 """
---> 83 return array(a, dtype, copy=False, order=order)
84
85
TypeError: float() argument must be a string or a number, not 'pandas._libs.interval.Interval'

Cannot convert a symbolic Tensor (truediv_17:0) to a numpy array

I'm trying to program a neuronal network based on the algorithm Pix2Pix. At the start when I call the functions of TensorFlow an error appears and I do not know how to resolve it.
The functions I call:
IMG_WIDTH = 256
IMG_HEIGHT = 256
def resize(inimg, tgimg, height, width):
inimg = tf.image.resize(inimg, [height, width])
tgimg = tf.image.resize(tgimg, [height, width])
return inimg, tgimg
def normalize(inimg, tgimg):
inimg = (inimg / 127.5) - 1
tgimg = (tgimg/127.5) - 1
return inimg, tgimg
def load_image(filename, augment=True):
inimg = tf.cast(tf.image.decode_jpeg(tf.io.read_file(INPATH + "/" + filename)), tf.float32)[..., :3]
tgimg = tf.cast(tf.image.decode_jpeg(tf.io.read_file(OUTPATH + "/" + filename)), tf.float32)[..., :3]
inimg, tgimg = resize(inimg, tgimg, IMG_HEIGHT, IMG_WIDTH)
inimg, tgimg = normalize(inimg, tgimg)
return inimg, tgimg
def load_train_image(filename):
return load_image(filename, True)
def load_test_image(filename):
return load_image(filename, False)
plt.imshow(((load_train_image(randurls[0])[0]) + 1)/ 2)
At the final I want to see the result of a load of my database but appears this error:
NotImplementedError Traceback (most recent call last)
<ipython-input-15-748ce6c46d5c> in <module>()
31 return load_image(filename, False)
32
---> 33 plt.imshow(((load_train_image(randurls[0])[0]) + 1)/ 2)
/usr/local/lib/python3.6/dist-packages/matplotlib/pyplot.py in imshow(X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, data, **kwargs)
2675 filternorm=filternorm, filterrad=filterrad, imlim=imlim,
2676 resample=resample, url=url, **({"data": data} if data is not
-> 2677 None else {}), **kwargs)
2678 sci(__ret)
2679 return __ret
/usr/local/lib/python3.6/dist-packages/matplotlib/__init__.py in inner(ax, data, *args, **kwargs)
1597 def inner(ax, *args, data=None, **kwargs):
1598 if data is None:
-> 1599 return func(ax, *map(sanitize_sequence, args), **kwargs)
1600
1601 bound = new_sig.bind(ax, *args, **kwargs)
/usr/local/lib/python3.6/dist-packages/matplotlib/cbook/deprecation.py in wrapper(*args, **kwargs)
367 f"%(removal)s. If any parameter follows {name!r}, they "
368 f"should be pass as keyword, not positionally.")
--> 369 return func(*args, **kwargs)
370
371 return wrapper
/usr/local/lib/python3.6/dist-packages/matplotlib/cbook/deprecation.py in wrapper(*args, **kwargs)
367 f"%(removal)s. If any parameter follows {name!r}, they "
368 f"should be pass as keyword, not positionally.")
--> 369 return func(*args, **kwargs)
370
371 return wrapper
/usr/local/lib/python3.6/dist-packages/matplotlib/axes/_axes.py in imshow(self, X, cmap, norm, aspect, interpolation, alpha, vmin, vmax, origin, extent, shape, filternorm, filterrad, imlim, resample, url, **kwargs)
5677 resample=resample, **kwargs)
5678
-> 5679 im.set_data(X)
5680 im.set_alpha(alpha)
5681 if im.get_clip_path() is None:
/usr/local/lib/python3.6/dist-packages/matplotlib/image.py in set_data(self, A)
678 if isinstance(A, Image.Image):
679 A = pil_to_array(A) # Needed e.g. to apply png palette.
--> 680 self._A = cbook.safe_masked_invalid(A, copy=True)
681
682 if (self._A.dtype != np.uint8 and
/usr/local/lib/python3.6/dist-packages/matplotlib/cbook/__init__.py in safe_masked_invalid(x, copy)
793
794 def safe_masked_invalid(x, copy=False):
--> 795 x = np.array(x, subok=True, copy=copy)
796 if not x.dtype.isnative:
797 # Note that the argument to `byteswap` is 'inplace',
/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py in __array__(self)
734 def __array__(self):
735 raise NotImplementedError("Cannot convert a symbolic Tensor ({}) to a numpy"
--> 736 " array.".format(self.name))
737
738 def __len__(self):
NotImplementedError: Cannot convert a symbolic Tensor (truediv_17:0) to a numpy array.

matplotlib.pyplot.hist() attribute error

I am quite new to python and computer science in general, so maybe I'm missing something obvious, but I would greatly appreciate it if someone could point it out!
I can't figure out what happened to my pyplot histogram function.
Independent of the list it is asked to plot it returns an Attribute Error. Does anyone know how I can fix this?
When running:
import matplotlib.pyplot as plt
import numpy as np
test = [np.random.randn() for i in range(100)]
plt.hist(test)
plt.show()
It returns:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-268-b26700f187c9> in <module>()
5 test = [np.random.randn() for i in range(10**3)]
6
----> 7 plt.hist(test)
8 plt.show()
c:\users\wiepvandertoorn\appdata\local\programs\python\python36\lib\site-packages\matplotlib\pyplot.py in hist(x, bins, range, density, weights, cumulative, bottom, histtype, align, orientation, rwidth, log, color, label, stacked, normed, hold, data, **kwargs)
3002 histtype=histtype, align=align, orientation=orientation,
3003 rwidth=rwidth, log=log, color=color, label=label,
-> 3004 stacked=stacked, normed=normed, data=data, **kwargs)
3005 finally:
3006 ax._hold = washold
c:\users\wiepvandertoorn\appdata\local\programs\python\python36\lib\site-packages\matplotlib\__init__.py in inner(ax, *args, **kwargs)
1708 warnings.warn(msg % (label_namer, func.__name__),
1709 RuntimeWarning, stacklevel=2)
-> 1710 return func(ax, *args, **kwargs)
1711 pre_doc = inner.__doc__
1712 if pre_doc is None:
c:\users\wiepvandertoorn\appdata\local\programs\python\python36\lib\site-packages\matplotlib\axes\_axes.py in hist(***failed resolving arguments***)
6284 patch = _barfunc(bins[:-1]+boffset, height, width,
6285 align='center', log=log,
-> 6286 color=c, **{bottom_kwarg: bottom})
6287 patches.append(patch)
6288 if stacked:
c:\users\wiepvandertoorn\appdata\local\programs\python\python36\lib\site-packages\matplotlib\__init__.py in inner(ax, *args, **kwargs)
1708 warnings.warn(msg % (label_namer, func.__name__),
1709 RuntimeWarning, stacklevel=2)
-> 1710 return func(ax, *args, **kwargs)
1711 pre_doc = inner.__doc__
1712 if pre_doc is None:
c:\users\wiepvandertoorn\appdata\local\programs\python\python36\lib\site-packages\matplotlib\axes\_axes.py in bar(self, *args, **kwargs)
2118
2119 if self.yaxis is not None:
-> 2120 y = self.convert_yunits(y)
2121 height = self.convert_yunits(height)
2122 if yerr is not None:
c:\users\wiepvandertoorn\appdata\local\programs\python\python36\lib\site-packages\matplotlib\artist.py in convert_yunits(self, y)
198 if ax is None or ax.yaxis is None:
199 return y
--> 200 return ax.yaxis.convert_units(y)
201
202 #property
c:\users\wiepvandertoorn\appdata\local\programs\python\python36\lib\site-packages\matplotlib\axis.py in convert_units(self, x)
1489 return x
1490
-> 1491 ret = self.converter.convert(x, self.units, self)
1492 return ret
1493
c:\users\wiepvandertoorn\appdata\local\programs\python\python36\lib\site-packages\matplotlib\category.py in convert(value, unit, axis)
41 data as floats
42 """
---> 43 vmap = dict(zip(axis.unit_data.seq, axis.unit_data.locs))
44
45 if isinstance(value, six.string_types):
AttributeError: 'NoneType' object has no attribute 'seq'

Pandas 0.19: Attribute error "unknown property color_cycle" still exists while performing boxplot

Unlike what has been said here, the AttributeError: Unknown property color_cycle is still persistent in the newest Pandas version (0.19.0-1).
In my case, I have a dataframe similar to this, although much longer (3,000,000 rows):
A B C
1 05010001 17 1
2 05020001 5 1
3 05020002 11 1
4 05020003 2 1
5 05030001 86 1
6 07030001 84 2
7 07030002 10 2
8 08010001 16 3
For some reason, if I implement this very example, there are no errors. In my actual case, executing the simple
df.boxplot(by='C')
triggers this mess:
AttributeError Traceback (most recent call last)
<ipython-input-51-5c645348f82f> in <module>()
----> 1 df.boxplot(by='C')
C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\pandas\core\frame.pyc in boxplot(self, column, by, ax, fontsize, rot, grid, figsize, layout, return_type, **kwds)
5514
5515 columns = list(data.dtype.names)
-> 5516 arrays = [data[k] for k in columns]
5517 return arrays, columns
5518 else:
C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\pandas\tools\plotting.pyc in boxplot(data, column, by, ax, fontsize, rot, grid, figsize, layout, return_type, **kwds)
2687 ax : Matplotlib axes object, optional
2688 fontsize : int or string
-> 2689 rot : label rotation angle
2690 figsize : A tuple (width, height) in inches
2691 grid : Setting this to True will show the grid
C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\pandas\tools\plotting.pyc in _grouped_plot_by_column(plotf, data, columns, by, numeric_only, grid, figsize, ax, layout, return_type, **kwargs)
3091 >>> df = pandas.DataFrame(data, columns=list('ABCD'), index=index)
3092 >>>
-> 3093 >>> grouped = df.groupby(level='lvl1')
3094 >>> boxplot_frame_groupby(grouped)
3095 >>>
C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\pandas\tools\plotting.pyc in plot_group(keys, values, ax)
2659 create a figure with the default figsize, causing the figsize=parameter to
2660 be ignored.
-> 2661 """
2662 if ax is None and len(plt.get_fignums()) > 0:
2663 ax = _gca()
C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\__init__.pyc in inner(ax, *args, **kwargs)
1810 warnings.warn(msg % (label_namer, func.__name__),
1811 RuntimeWarning, stacklevel=2)
-> 1812 return func(ax, *args, **kwargs)
1813 pre_doc = inner.__doc__
1814 if pre_doc is None:
C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\axes\_axes.pyc in boxplot(self, x, notch, sym, vert, whis, positions, widths, patch_artist, bootstrap, usermedians, conf_intervals, meanline, showmeans, showcaps, showbox, showfliers, boxprops, labels, flierprops, medianprops, meanprops, capprops, whiskerprops, manage_xticks)
3321 meanline=meanline, showfliers=showfliers,
3322 capprops=capprops, whiskerprops=whiskerprops,
-> 3323 manage_xticks=manage_xticks)
3324 return artists
3325
C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\axes\_axes.pyc in bxp(self, bxpstats, positions, widths, vert, patch_artist, shownotches, showmeans, showcaps, showbox, showfliers, boxprops, whiskerprops, flierprops, medianprops, capprops, meanprops, meanline, manage_xticks)
3650 boxes.extend(dopatch(box_x, box_y, **final_boxprops))
3651 else:
-> 3652 boxes.extend(doplot(box_x, box_y, **final_boxprops))
3653
3654 # draw the whiskers
C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\axes\_axes.pyc in doplot(*args, **kwargs)
3564 if vert:
3565 def doplot(*args, **kwargs):
-> 3566 return self.plot(*args, **kwargs)
3567
3568 def dopatch(xs, ys, **kwargs):
C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\__init__.pyc in inner(ax, *args, **kwargs)
1810 warnings.warn(msg % (label_namer, func.__name__),
1811 RuntimeWarning, stacklevel=2)
-> 1812 return func(ax, *args, **kwargs)
1813 pre_doc = inner.__doc__
1814 if pre_doc is None:
C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\axes\_axes.pyc in plot(self, *args, **kwargs)
1422 kwargs['color'] = c
1423
-> 1424 for line in self._get_lines(*args, **kwargs):
1425 self.add_line(line)
1426 lines.append(line)
C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\axes\_base.pyc in _grab_next_args(self, *args, **kwargs)
384 return
385 if len(remaining) <= 3:
--> 386 for seg in self._plot_args(remaining, kwargs):
387 yield seg
388 return
C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\axes\_base.pyc in _plot_args(self, tup, kwargs)
372 ncx, ncy = x.shape[1], y.shape[1]
373 for j in xrange(max(ncx, ncy)):
--> 374 seg = func(x[:, j % ncx], y[:, j % ncy], kw, kwargs)
375 ret.append(seg)
376 return ret
C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\axes\_base.pyc in _makeline(self, x, y, kw, kwargs)
278 default_dict = self._getdefaults(None, kw, kwargs)
279 self._setdefaults(default_dict, kw, kwargs)
--> 280 seg = mlines.Line2D(x, y, **kw)
281 self.set_lineprops(seg, **kwargs)
282 return seg
C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\lines.pyc in __init__(self, xdata, ydata, linewidth, linestyle, color, marker, markersize, markeredgewidth, markeredgecolor, markerfacecolor, markerfacecoloralt, fillstyle, antialiased, dash_capstyle, solid_capstyle, dash_joinstyle, solid_joinstyle, pickradius, drawstyle, markevery, **kwargs)
365 # update kwargs before updating data to give the caller a
366 # chance to init axes (and hence unit support)
--> 367 self.update(kwargs)
368 self.pickradius = pickradius
369 self.ind_offset = 0
C:\Users\B4058846\AppData\Local\Enthought\Canopy\User\lib\site-packages\matplotlib\artist.pyc in update(self, props)
854 func = getattr(self, 'set_' + k, None)
855 if func is None or not six.callable(func):
--> 856 raise AttributeError('Unknown property %s' % k)
857 func(v)
858 changed = True
AttributeError: Unknown property color_cycle
And I am left with a blank 4-pane plot, when there should have been just one with 5 boxplot columns:
How to fix this?
I've verified myself that one needs to have pandas 0.19.0-1 together with matplotlib 1.5.1-8 to not experience this error.

Categories

Resources