Related
I have been trying to fix this for hours now and I am really frustrated. The only thing I want to do is highlight my plot at the timepoints 2,6 and 10 (as shown in the image)
I want to create multiple plots (I have different features (y-axis) and groups (blacked out) for which I want these plots).
This is my code:
for elem in mylist:
for title in myotherlist:
to_mark = [False, True, False, False, False, True, False, False, False, True]
to_mark2 = [1,5,9]
sns.lineplot(data=data, x="time_point", y=elem, hue=title, err_style="bars", ci=95, markevery = [1,5,9], marker = '|', markersize=20, fillstyle='none', markeredgewidth=1.5, markeredgecolor='black')
plt.savefig(file_path)
plt.clf()
plt.cla()
plt.close()
I tried
markevery = to_mark and
markevery = to_mark2
But nothing seems to work. I get the error message
IndexError Traceback (most recent call last)
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\lines.py in _mark_every_path(markevery, tpath, affine, ax_transform)
215 try:
--> 216 return Path(verts[markevery],
217 _slice_or_none(codes, markevery))
IndexError: index 5 is out of bounds for axis 0 with size 2
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-318-7c71faf85be6> in <module>()
65
66 #plt.plot()
---> 67 plt.savefig(file_path)
68 #with open(file_path, 'wb') as f:
69 #plt.savefig(file_path)
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\pyplot.py in savefig(*args, **kwargs)
708 def savefig(*args, **kwargs):
709 fig = gcf()
--> 710 res = fig.savefig(*args, **kwargs)
711 fig.canvas.draw_idle() # need this if 'transparent=True' to reset colors
712 return res
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\figure.py in savefig(self, fname, **kwargs)
2033 self.set_frameon(frameon)
2034
-> 2035 self.canvas.print_figure(fname, **kwargs)
2036
2037 if frameon:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2261 orientation=orientation,
2262 bbox_inches_restore=_bbox_inches_restore,
-> 2263 **kwargs)
2264 finally:
2265 if bbox_inches and restore_bbox:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\backends\backend_pdf.py in print_pdf(self, filename, **kwargs)
2584 RendererPdf(file, image_dpi, height, width),
2585 bbox_inches_restore=_bbox_inches_restore)
-> 2586 self.figure.draw(renderer)
2587 renderer.finalize()
2588 if not isinstance(filename, PdfPages):
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\figure.py in draw(self, renderer)
1473
1474 mimage._draw_list_compositing_images(
-> 1475 renderer, self, artists, self.suppressComposite)
1476
1477 renderer.close_group('figure')
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
139 if not_composite or not has_images:
140 for a in artists:
--> 141 a.draw(renderer)
142 else:
143 # Composite any adjacent images together
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe)
2605 renderer.stop_rasterizing()
2606
-> 2607 mimage._draw_list_compositing_images(renderer, self, artists)
2608
2609 renderer.close_group('axes')
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
139 if not_composite or not has_images:
140 for a in artists:
--> 141 a.draw(renderer)
142 else:
143 # Composite any adjacent images together
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\lines.py in draw(self, renderer)
809 if markevery is not None:
810 subsampled = _mark_every_path(markevery, tpath,
--> 811 affine, self.axes.transAxes)
812 else:
813 subsampled = tpath
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\lines.py in _mark_every_path(markevery, tpath, affine, ax_transform)
220 raise ValueError('`markevery` is iterable but '
221 'not a valid form of numpy fancy indexing; '
--> 222 'markevery=%s' % (markevery,))
223 else:
224 raise ValueError('Value of `markevery` is not '
ValueError: `markevery` is iterable but not a valid form of numpy fancy indexing; markevery=[1, 5, 9]
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\lines.py in _mark_every_path(markevery, tpath, affine, ax_transform)
215 try:
--> 216 return Path(verts[markevery],
217 _slice_or_none(codes, markevery))
IndexError: index 5 is out of bounds for axis 0 with size 2
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
~\Anaconda3\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
330 pass
331 else:
--> 332 return printer(obj)
333 # Finally look for special method names
334 method = get_real_method(obj, self.print_method)
~\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in <lambda>(fig)
235
236 if 'png' in formats:
--> 237 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
238 if 'retina' in formats or 'png2x' in formats:
239 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
~\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs)
119
120 bytes_io = BytesIO()
--> 121 fig.canvas.print_figure(bytes_io, **kw)
122 data = bytes_io.getvalue()
123 if fmt == 'svg':
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2210 orientation=orientation,
2211 dryrun=True,
-> 2212 **kwargs)
2213 renderer = self.figure._cachedRenderer
2214 bbox_inches = self.figure.get_tightbbox(renderer)
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\backends\backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs)
511
512 def print_png(self, filename_or_obj, *args, **kwargs):
--> 513 FigureCanvasAgg.draw(self)
514 renderer = self.get_renderer()
515 original_dpi = renderer.dpi
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\backends\backend_agg.py in draw(self)
431 # if toolbar:
432 # toolbar.set_cursor(cursors.WAIT)
--> 433 self.figure.draw(self.renderer)
434 # A GUI class may be need to update a window using this draw, so
435 # don't forget to call the superclass.
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\figure.py in draw(self, renderer)
1473
1474 mimage._draw_list_compositing_images(
-> 1475 renderer, self, artists, self.suppressComposite)
1476
1477 renderer.close_group('figure')
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
139 if not_composite or not has_images:
140 for a in artists:
--> 141 a.draw(renderer)
142 else:
143 # Composite any adjacent images together
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe)
2605 renderer.stop_rasterizing()
2606
-> 2607 mimage._draw_list_compositing_images(renderer, self, artists)
2608
2609 renderer.close_group('axes')
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
139 if not_composite or not has_images:
140 for a in artists:
--> 141 a.draw(renderer)
142 else:
143 # Composite any adjacent images together
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\lines.py in draw(self, renderer)
809 if markevery is not None:
810 subsampled = _mark_every_path(markevery, tpath,
--> 811 affine, self.axes.transAxes)
812 else:
813 subsampled = tpath
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\lines.py in _mark_every_path(markevery, tpath, affine, ax_transform)
220 raise ValueError('`markevery` is iterable but '
221 'not a valid form of numpy fancy indexing; '
--> 222 'markevery=%s' % (markevery,))
223 else:
224 raise ValueError('Value of `markevery` is not '
ValueError: `markevery` is iterable but not a valid form of numpy fancy indexing; markevery=[1, 5, 9]
if I set markevery = to_mark, I get
IndexError Traceback (most recent call last)
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\lines.py in _mark_every_path(markevery, tpath, affine, ax_transform)
215 try:
--> 216 return Path(verts[markevery],
217 _slice_or_none(codes, markevery))
IndexError: boolean index did not match indexed array along dimension 0; dimension is 2 but corresponding boolean dimension is 10
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-319-ce96ba06eb23> in <module>()
65
66 #plt.plot()
---> 67 plt.savefig(file_path)
68 #with open(file_path, 'wb') as f:
69 #plt.savefig(file_path)
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\pyplot.py in savefig(*args, **kwargs)
708 def savefig(*args, **kwargs):
709 fig = gcf()
--> 710 res = fig.savefig(*args, **kwargs)
711 fig.canvas.draw_idle() # need this if 'transparent=True' to reset colors
712 return res
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\figure.py in savefig(self, fname, **kwargs)
2033 self.set_frameon(frameon)
2034
-> 2035 self.canvas.print_figure(fname, **kwargs)
2036
2037 if frameon:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2261 orientation=orientation,
2262 bbox_inches_restore=_bbox_inches_restore,
-> 2263 **kwargs)
2264 finally:
2265 if bbox_inches and restore_bbox:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\backends\backend_pdf.py in print_pdf(self, filename, **kwargs)
2584 RendererPdf(file, image_dpi, height, width),
2585 bbox_inches_restore=_bbox_inches_restore)
-> 2586 self.figure.draw(renderer)
2587 renderer.finalize()
2588 if not isinstance(filename, PdfPages):
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\figure.py in draw(self, renderer)
1473
1474 mimage._draw_list_compositing_images(
-> 1475 renderer, self, artists, self.suppressComposite)
1476
1477 renderer.close_group('figure')
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
139 if not_composite or not has_images:
140 for a in artists:
--> 141 a.draw(renderer)
142 else:
143 # Composite any adjacent images together
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe)
2605 renderer.stop_rasterizing()
2606
-> 2607 mimage._draw_list_compositing_images(renderer, self, artists)
2608
2609 renderer.close_group('axes')
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
139 if not_composite or not has_images:
140 for a in artists:
--> 141 a.draw(renderer)
142 else:
143 # Composite any adjacent images together
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\lines.py in draw(self, renderer)
809 if markevery is not None:
810 subsampled = _mark_every_path(markevery, tpath,
--> 811 affine, self.axes.transAxes)
812 else:
813 subsampled = tpath
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\lines.py in _mark_every_path(markevery, tpath, affine, ax_transform)
220 raise ValueError('`markevery` is iterable but '
221 'not a valid form of numpy fancy indexing; '
--> 222 'markevery=%s' % (markevery,))
223 else:
224 raise ValueError('Value of `markevery` is not '
ValueError: `markevery` is iterable but not a valid form of numpy fancy indexing; markevery=[False, True, False, False, False, True, False, False, False, True]
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\lines.py in _mark_every_path(markevery, tpath, affine, ax_transform)
215 try:
--> 216 return Path(verts[markevery],
217 _slice_or_none(codes, markevery))
IndexError: boolean index did not match indexed array along dimension 0; dimension is 2 but corresponding boolean dimension is 10
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
~\Anaconda3\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
330 pass
331 else:
--> 332 return printer(obj)
333 # Finally look for special method names
334 method = get_real_method(obj, self.print_method)
~\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in <lambda>(fig)
235
236 if 'png' in formats:
--> 237 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
238 if 'retina' in formats or 'png2x' in formats:
239 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
~\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs)
119
120 bytes_io = BytesIO()
--> 121 fig.canvas.print_figure(bytes_io, **kw)
122 data = bytes_io.getvalue()
123 if fmt == 'svg':
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2210 orientation=orientation,
2211 dryrun=True,
-> 2212 **kwargs)
2213 renderer = self.figure._cachedRenderer
2214 bbox_inches = self.figure.get_tightbbox(renderer)
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\backends\backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs)
511
512 def print_png(self, filename_or_obj, *args, **kwargs):
--> 513 FigureCanvasAgg.draw(self)
514 renderer = self.get_renderer()
515 original_dpi = renderer.dpi
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\backends\backend_agg.py in draw(self)
431 # if toolbar:
432 # toolbar.set_cursor(cursors.WAIT)
--> 433 self.figure.draw(self.renderer)
434 # A GUI class may be need to update a window using this draw, so
435 # don't forget to call the superclass.
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\figure.py in draw(self, renderer)
1473
1474 mimage._draw_list_compositing_images(
-> 1475 renderer, self, artists, self.suppressComposite)
1476
1477 renderer.close_group('figure')
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
139 if not_composite or not has_images:
140 for a in artists:
--> 141 a.draw(renderer)
142 else:
143 # Composite any adjacent images together
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe)
2605 renderer.stop_rasterizing()
2606
-> 2607 mimage._draw_list_compositing_images(renderer, self, artists)
2608
2609 renderer.close_group('axes')
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
139 if not_composite or not has_images:
140 for a in artists:
--> 141 a.draw(renderer)
142 else:
143 # Composite any adjacent images together
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\lines.py in draw(self, renderer)
809 if markevery is not None:
810 subsampled = _mark_every_path(markevery, tpath,
--> 811 affine, self.axes.transAxes)
812 else:
813 subsampled = tpath
~\AppData\Roaming\Python\Python36\site-packages\matplotlib\lines.py in _mark_every_path(markevery, tpath, affine, ax_transform)
220 raise ValueError('`markevery` is iterable but '
221 'not a valid form of numpy fancy indexing; '
--> 222 'markevery=%s' % (markevery,))
223 else:
224 raise ValueError('Value of `markevery` is not '
ValueError: `markevery` is iterable but not a valid form of numpy fancy indexing; markevery=[False, True, False, False, False, True, False, False, False, True]
I'd be very thankful for any input!
I have a code that used to run perfectly fine. However, it now raises the error
TypeError: object of type 'NoneType' has no len()
in the line plt.savefig. I use a Jupyter notebook (through Anaconda).
UPDATING: The problem is with "ax.legend". When it is commented, the code runs.
I looked here but couldn't find a solution.
The code:
import matplotlib.pyplot as plt
.
.
.
plt.rc('xtick', labelsize=18)
plt.rc('ytick', labelsize=18)
fig, ax = plt.subplots(figsize=(15,15))
for label,color,shape,inds in zip(labels,colors,shapes,indss):
ax.scatter(pca_coor[inds, 0], pca_coor[inds, 1], c=color,
label=label, s=150, marker=shape)
ax.legend(labels, prop={'size': 20})
ax.set_title('title',fontdict={'fontsize': 30, 'fontweight': 'medium'})
ax.set_xlabel('PC 1', fontdict={'fontsize': 22, 'fontweight': 'medium'})
ax.set_ylabel('PC 2', fontdict={'fontsize': 22, 'fontweight': 'medium'})
# save the figure to file
plt.savefig('picfile.png')
plt.close()
And this is the entire error:
-> 2486 plt.savefig('picfile.png')
2487 #plt.clf()
2488 plt.close()
~\Anaconda3\lib\site-packages\matplotlib\pyplot.py in savefig(*args, **kwargs)
935 def savefig(*args, **kwargs):
936 fig = gcf()
--> 937 res = fig.savefig(*args, **kwargs)
938 fig.canvas.draw_idle() # need this if 'transparent=True' to reset colors
939 return res
~\Anaconda3\lib\site-packages\matplotlib\figure.py in savefig(self, fname, transparent, **kwargs)
2957 patch.set_edgecolor('none')
2958
-> 2959 self.canvas.print_figure(fname, **kwargs)
2960
2961 if transparent:
~\Anaconda3\lib\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)
2259 orientation=orientation,
2260 bbox_inches_restore=_bbox_inches_restore,
-> 2261 **kwargs)
2262 finally:
2263 if bbox_inches and restore_bbox:
~\Anaconda3\lib\site-packages\matplotlib\backend_bases.py in wrapper(*args, **kwargs)
1667 kwargs.pop(arg)
1668
-> 1669 return func(*args, **kwargs)
1670
1671 return wrapper
~\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in print_png(self, filename_or_obj, metadata, pil_kwargs, *args)
506 *metadata*, including the default 'Software' key.
507 """
--> 508 FigureCanvasAgg.draw(self)
509 mpl.image.imsave(
510 filename_or_obj, self.buffer_rgba(), format="png", origin="upper",
~\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in draw(self)
404 (self.toolbar._wait_cursor_for_draw_cm() if self.toolbar
405 else nullcontext()):
--> 406 self.figure.draw(self.renderer)
407 # A GUI class may be need to update a window using this draw, so
408 # don't forget to call the superclass.
~\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
72 #wraps(draw)
73 def draw_wrapper(artist, renderer, *args, **kwargs):
---> 74 result = draw(artist, renderer, *args, **kwargs)
75 if renderer._rasterizing:
76 renderer.stop_rasterizing()
~\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
49 renderer.start_filter()
50
---> 51 return draw(artist, renderer, *args, **kwargs)
52 finally:
53 if artist.get_agg_filter() is not None:
~\Anaconda3\lib\site-packages\matplotlib\figure.py in draw(self, renderer)
2733 self.patch.draw(renderer)
2734 mimage._draw_list_compositing_images(
-> 2735 renderer, self, artists, self.suppressComposite)
2736
2737 for sfig in self.subfigs:
~\Anaconda3\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
130 if not_composite or not has_images:
131 for a in artists:
--> 132 a.draw(renderer)
133 else:
134 # Composite any adjacent images together
~\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
49 renderer.start_filter()
50
---> 51 return draw(artist, renderer, *args, **kwargs)
52 finally:
53 if artist.get_agg_filter() is not None:
~\Anaconda3\lib\site-packages\matplotlib\_api\deprecation.py in wrapper(*inner_args, **inner_kwargs)
429 else deprecation_addendum,
430 **kwargs)
--> 431 return func(*inner_args, **inner_kwargs)
432
433 return wrapper
~\Anaconda3\lib\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe)
2923 renderer.stop_rasterizing()
2924
-> 2925 mimage._draw_list_compositing_images(renderer, self, artists)
2926
2927 renderer.close_group('axes')
~\Anaconda3\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
130 if not_composite or not has_images:
131 for a in artists:
--> 132 a.draw(renderer)
133 else:
134 # Composite any adjacent images together
~\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
49 renderer.start_filter()
50
---> 51 return draw(artist, renderer, *args, **kwargs)
52 finally:
53 if artist.get_agg_filter() is not None:
~\Anaconda3\lib\site-packages\matplotlib\legend.py in draw(self, renderer)
612
613 self.legendPatch.draw(renderer)
--> 614 self._legend_box.draw(renderer)
615
616 renderer.close_group('legend')
~\Anaconda3\lib\site-packages\matplotlib\offsetbox.py in draw(self, renderer)
366 for c, (ox, oy) in zip(self.get_visible_children(), offsets):
367 c.set_offset((px + ox, py + oy))
--> 368 c.draw(renderer)
369
370 bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
~\Anaconda3\lib\site-packages\matplotlib\offsetbox.py in draw(self, renderer)
366 for c, (ox, oy) in zip(self.get_visible_children(), offsets):
367 c.set_offset((px + ox, py + oy))
--> 368 c.draw(renderer)
369
370 bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
~\Anaconda3\lib\site-packages\matplotlib\offsetbox.py in draw(self, renderer)
366 for c, (ox, oy) in zip(self.get_visible_children(), offsets):
367 c.set_offset((px + ox, py + oy))
--> 368 c.draw(renderer)
369
370 bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
~\Anaconda3\lib\site-packages\matplotlib\offsetbox.py in draw(self, renderer)
366 for c, (ox, oy) in zip(self.get_visible_children(), offsets):
367 c.set_offset((px + ox, py + oy))
--> 368 c.draw(renderer)
369
370 bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
~\Anaconda3\lib\site-packages\matplotlib\offsetbox.py in draw(self, renderer)
692 if self._clip_children and not (c.clipbox or c._clippath):
693 c.set_clip_path(tpath)
--> 694 c.draw(renderer)
695
696 bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
~\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
49 renderer.start_filter()
50
---> 51 return draw(artist, renderer, *args, **kwargs)
52 finally:
53 if artist.get_agg_filter() is not None:
~\Anaconda3\lib\site-packages\matplotlib\collections.py in draw(self, renderer)
1007 def draw(self, renderer):
1008 self.set_sizes(self._sizes, self.figure.dpi)
-> 1009 super().draw(renderer)
1010
1011
~\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
49 renderer.start_filter()
50
---> 51 return draw(artist, renderer, *args, **kwargs)
52 finally:
53 if artist.get_agg_filter() is not None:
~\Anaconda3\lib\site-packages\matplotlib\collections.py in draw(self, renderer)
378 do_single_path_optimization = False
379 if (len(paths) == 1 and len(trans) <= 1 and
--> 380 len(facecolors) == 1 and len(edgecolors) == 1 and
381 len(self._linewidths) == 1 and
382 all(ls[1] is None for ls in self._linestyles) and
TypeError: object of type 'NoneType' has no len()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
~\Anaconda3\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
339 pass
340 else:
--> 341 return printer(obj)
342 # Finally look for special method names
343 method = get_real_method(obj, self.print_method)
~\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in <lambda>(fig)
246
247 if 'png' in formats:
--> 248 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
249 if 'retina' in formats or 'png2x' in formats:
250 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
~\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs)
130 FigureCanvasBase(fig)
131
--> 132 fig.canvas.print_figure(bytes_io, **kw)
133 data = bytes_io.getvalue()
134 if fmt == 'svg':
~\Anaconda3\lib\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)
2228 else suppress())
2229 with ctx:
-> 2230 self.figure.draw(renderer)
2231
2232 if bbox_inches:
~\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
72 #wraps(draw)
73 def draw_wrapper(artist, renderer, *args, **kwargs):
---> 74 result = draw(artist, renderer, *args, **kwargs)
75 if renderer._rasterizing:
76 renderer.stop_rasterizing()
~\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
49 renderer.start_filter()
50
---> 51 return draw(artist, renderer, *args, **kwargs)
52 finally:
53 if artist.get_agg_filter() is not None:
~\Anaconda3\lib\site-packages\matplotlib\figure.py in draw(self, renderer)
2733 self.patch.draw(renderer)
2734 mimage._draw_list_compositing_images(
-> 2735 renderer, self, artists, self.suppressComposite)
2736
2737 for sfig in self.subfigs:
~\Anaconda3\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
130 if not_composite or not has_images:
131 for a in artists:
--> 132 a.draw(renderer)
133 else:
134 # Composite any adjacent images together
~\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
49 renderer.start_filter()
50
---> 51 return draw(artist, renderer, *args, **kwargs)
52 finally:
53 if artist.get_agg_filter() is not None:
~\Anaconda3\lib\site-packages\matplotlib\_api\deprecation.py in wrapper(*inner_args, **inner_kwargs)
429 else deprecation_addendum,
430 **kwargs)
--> 431 return func(*inner_args, **inner_kwargs)
432
433 return wrapper
~\Anaconda3\lib\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe)
2923 renderer.stop_rasterizing()
2924
-> 2925 mimage._draw_list_compositing_images(renderer, self, artists)
2926
2927 renderer.close_group('axes')
~\Anaconda3\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
130 if not_composite or not has_images:
131 for a in artists:
--> 132 a.draw(renderer)
133 else:
134 # Composite any adjacent images together
~\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
49 renderer.start_filter()
50
---> 51 return draw(artist, renderer, *args, **kwargs)
52 finally:
53 if artist.get_agg_filter() is not None:
~\Anaconda3\lib\site-packages\matplotlib\legend.py in draw(self, renderer)
612
613 self.legendPatch.draw(renderer)
--> 614 self._legend_box.draw(renderer)
615
616 renderer.close_group('legend')
~\Anaconda3\lib\site-packages\matplotlib\offsetbox.py in draw(self, renderer)
366 for c, (ox, oy) in zip(self.get_visible_children(), offsets):
367 c.set_offset((px + ox, py + oy))
--> 368 c.draw(renderer)
369
370 bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
~\Anaconda3\lib\site-packages\matplotlib\offsetbox.py in draw(self, renderer)
366 for c, (ox, oy) in zip(self.get_visible_children(), offsets):
367 c.set_offset((px + ox, py + oy))
--> 368 c.draw(renderer)
369
370 bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
~\Anaconda3\lib\site-packages\matplotlib\offsetbox.py in draw(self, renderer)
366 for c, (ox, oy) in zip(self.get_visible_children(), offsets):
367 c.set_offset((px + ox, py + oy))
--> 368 c.draw(renderer)
369
370 bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
~\Anaconda3\lib\site-packages\matplotlib\offsetbox.py in draw(self, renderer)
366 for c, (ox, oy) in zip(self.get_visible_children(), offsets):
367 c.set_offset((px + ox, py + oy))
--> 368 c.draw(renderer)
369
370 bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
~\Anaconda3\lib\site-packages\matplotlib\offsetbox.py in draw(self, renderer)
692 if self._clip_children and not (c.clipbox or c._clippath):
693 c.set_clip_path(tpath)
--> 694 c.draw(renderer)
695
696 bbox_artist(self, renderer, fill=False, props=dict(pad=0.))
~\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
49 renderer.start_filter()
50
---> 51 return draw(artist, renderer, *args, **kwargs)
52 finally:
53 if artist.get_agg_filter() is not None:
~\Anaconda3\lib\site-packages\matplotlib\collections.py in draw(self, renderer)
1007 def draw(self, renderer):
1008 self.set_sizes(self._sizes, self.figure.dpi)
-> 1009 super().draw(renderer)
1010
1011
~\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
49 renderer.start_filter()
50
---> 51 return draw(artist, renderer, *args, **kwargs)
52 finally:
53 if artist.get_agg_filter() is not None:
~\Anaconda3\lib\site-packages\matplotlib\collections.py in draw(self, renderer)
378 do_single_path_optimization = False
379 if (len(paths) == 1 and len(trans) <= 1 and
--> 380 len(facecolors) == 1 and len(edgecolors) == 1 and
381 len(self._linewidths) == 1 and
382 all(ls[1] is None for ls in self._linestyles) and
TypeError: object of type 'NoneType' has no len()
<Figure size 1080x1080 with 1 Axes>
matplotlib version: 3.4.0
Thanks in advance.
I managed to resolve the problem by changing "c" to "color" inside ax.scatter, and also remove the "labels" from ax.legend.
I am trying to visualize 5-D mix data using bubble charts by leveraging the concepts of hue, size and depth.
I used the following code:
fig = plt.figure(figsize=(8, 6))
ax = fig.add_subplot(111, projection='3d')
t = fig.suptitle('Wine Residual Sugar - Alcohol Content - Acidity - Total Sulfur Dioxide - Type', fontsize=14)
xs = list(iris_data['SepalLengthCm'])
ys = list(iris_data['SepalWidthCm'])
zs = list(iris_data['PetalLengthCm'])
data_points = [(x, y, z) for x, y, z in zip(xs, ys, zs)]
ss = list(iris_data['PetalWidthCm'])
colors = ['red' if wt == 'red' else 'yellow' for wt in list(iris_data['Species'])]
for data, color, size in zip(data_points, colors, ss):
x, y, z = data
ax.scatter(x, y, z, alpha=0.4, c=color, edgecolors='none', s=size)
ax.set_xlabel('Sepal Length')
ax.set_ylabel('Sepal Width')
ax.set_zlabel('Petal Length')
But it is giving the following error:
operands could not be broadcast together with remapped shapes [original->remapped]: (0,4) and requested shape (1,4)
<Figure size 576x432 with 1 Axes>
I am adding the full trace of the error I am getting:
Text(0.5, 0, 'Petal Length')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
~\anaconda\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
339 pass
340 else:
--> 341 return printer(obj)
342 # Finally look for special method names
343 method = get_real_method(obj, self.print_method)
~\anaconda\lib\site-packages\IPython\core\pylabtools.py in <lambda>(fig)
246
247 if 'png' in formats:
--> 248 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
249 if 'retina' in formats or 'png2x' in formats:
250 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
~\anaconda\lib\site-packages\IPython\core\pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs)
130 FigureCanvasBase(fig)
131
--> 132 fig.canvas.print_figure(bytes_io, **kw)
133 data = bytes_io.getvalue()
134 if fmt == 'svg':
~\anaconda\lib\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)
2191 else suppress())
2192 with ctx:
-> 2193 self.figure.draw(renderer)
2194
2195 bbox_inches = self.figure.get_tightbbox(
~\anaconda\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
39 renderer.start_filter()
40
---> 41 return draw(artist, renderer, *args, **kwargs)
42 finally:
43 if artist.get_agg_filter() is not None:
~\anaconda\lib\site-packages\matplotlib\figure.py in draw(self, renderer)
1861
1862 self.patch.draw(renderer)
-> 1863 mimage._draw_list_compositing_images(
1864 renderer, self, artists, self.suppressComposite)
1865
~\anaconda\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
129 if not_composite or not has_images:
130 for a in artists:
--> 131 a.draw(renderer)
132 else:
133 # Composite any adjacent images together
~\anaconda\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
39 renderer.start_filter()
40
---> 41 return draw(artist, renderer, *args, **kwargs)
42 finally:
43 if artist.get_agg_filter() is not None:
~\anaconda\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py in draw(self, renderer)
443 for axis in self._get_axis_list()) + 1
444 for i, col in enumerate(
--> 445 sorted(self.collections,
446 key=lambda col: col.do_3d_projection(renderer),
447 reverse=True)):
~\anaconda\lib\site-packages\mpl_toolkits\mplot3d\axes3d.py in <lambda>(col)
444 for i, col in enumerate(
445 sorted(self.collections,
--> 446 key=lambda col: col.do_3d_projection(renderer),
447 reverse=True)):
448 col.zorder = zorder_offset + i
~\anaconda\lib\site-packages\mpl_toolkits\mplot3d\art3d.py in do_3d_projection(self, renderer)
492 fcs = (_zalpha(self._facecolor3d, vzs) if self._depthshade else
493 self._facecolor3d)
--> 494 ecs = (_zalpha(self._edgecolor3d, vzs) if self._depthshade else
495 self._edgecolor3d)
496 sizes = self._sizes3d
~\anaconda\lib\site-packages\mpl_toolkits\mplot3d\art3d.py in _zalpha(colors, zs)
808 norm = Normalize(min(zs), max(zs))
809 sats = 1 - norm(zs) * 0.7
--> 810 rgba = np.broadcast_to(mcolors.to_rgba_array(colors), (len(zs), 4))
811 return np.column_stack([rgba[:, :3], rgba[:, 3] * sats])
<__array_function__ internals> in broadcast_to(*args, **kwargs)
~\anaconda\lib\site-packages\numpy\lib\stride_tricks.py in broadcast_to(array, shape, subok)
178 [1, 2, 3]])
179 """
--> 180 return _broadcast_to(array, shape, subok=subok, readonly=True)
181
182
~\anaconda\lib\site-packages\numpy\lib\stride_tricks.py in _broadcast_to(array, shape, subok, readonly)
121 'negative')
122 extras = []
--> 123 it = np.nditer(
124 (array,), flags=['multi_index', 'refs_ok', 'zerosize_ok'] + extras,
125 op_flags=['readonly'], itershape=shape, order='C')
ValueError: operands could not be broadcast together with remapped shapes [original->remapped]: (0,4) and requested shape (1,4)
<Figure size 576x432 with 1 Axes>
I'm trying to write a multiplateform script which works OK on Mac Os but failed on Windows if I load the french local. I use the following code at startup to load the locale depending on the host OS :
import locale
from sys import platform
if platform == "linux" or platform == "linux2":
locale.setlocale( locale.LC_ALL, 'fr_FR')
elif platform == "darwin":
locale.setlocale( locale.LC_ALL, 'fr_FR')
elif platform == "win32":
locale.setlocale( locale.LC_ALL, 'French_France.1252')
My code also use following libraries :
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import time as time
import datetime
The code failed when I display a localised date on a matplotlib figure.
The faulty line is :
fig.tight_layout()
And return this error :
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 10: invalid continuation byte
Obviously a problem of encoding.
My computer use windows 10 and my python setup is Python 3.6.4 |Anaconda 4.4.0 (64-bit)| (default, Jan 16 2018, 10:22:32) [MSC v.1900 64 bit (AMD64)]
The full error returned is :
'Periode du lundi 04/12/2017 17:11:41 au lundi 04/12/2017 21:59:59 \n Duree de 4h48m19s'
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
<ipython-input-28-4b9aa2e0100e> in <module>()
48 fig=trace_et_leq_ln(et)
49
---> 50 fig.tight_layout()
51 fig.subplots_adjust(top=0.85)
52
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\figure.py in tight_layout(self, renderer, pad, h_pad, w_pad, rect)
2028 kwargs = get_tight_layout_figure(
2029 self, self.axes, subplotspec_list, renderer,
-> 2030 pad=pad, h_pad=h_pad, w_pad=w_pad, rect=rect)
2031 self.subplots_adjust(**kwargs)
2032
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\tight_layout.py in get_tight_layout_figure(fig, axes_list, subplotspec_list, renderer, pad, h_pad, w_pad, rect)
349 subplot_list=subplot_list,
350 ax_bbox_list=ax_bbox_list,
--> 351 pad=pad, h_pad=h_pad, w_pad=w_pad)
352
353 if rect is not None:
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\tight_layout.py in auto_adjust_subplotpars(fig, renderer, nrows_ncols, num1num2_list, subplot_list, ax_bbox_list, pad, h_pad, w_pad, rect)
127 continue
128
--> 129 tight_bbox_raw = union([ax.get_tightbbox(renderer) for ax in subplots
130 if ax.get_visible()])
131 tight_bbox = TransformedBbox(tight_bbox_raw,
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\tight_layout.py in <listcomp>(.0)
128
129 tight_bbox_raw = union([ax.get_tightbbox(renderer) for ax in subplots
--> 130 if ax.get_visible()])
131 tight_bbox = TransformedBbox(tight_bbox_raw,
132 fig.transFigure.inverted())
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axes\_base.py in get_tightbbox(self, renderer, call_axes_locator)
4013 bb.append(self._right_title.get_window_extent(renderer))
4014
-> 4015 bb_xaxis = self.xaxis.get_tightbbox(renderer)
4016 if bb_xaxis:
4017 bb.append(bb_xaxis)
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in get_tightbbox(self, renderer)
1088 return
1089
-> 1090 ticks_to_draw = self._update_ticks(renderer)
1091 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
1092 renderer)
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in _update_ticks(self, renderer)
972
973 interval = self.get_view_interval()
--> 974 tick_tups = list(self.iter_ticks())
975 if self._smart_bounds and tick_tups:
976 # handle inverted limits
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in iter_ticks(self)
919 self.major.formatter.set_locs(majorLocs)
920 majorLabels = [self.major.formatter(val, i)
--> 921 for i, val in enumerate(majorLocs)]
922
923 minorLocs = self.minor.locator()
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in <listcomp>(.0)
919 self.major.formatter.set_locs(majorLocs)
920 majorLabels = [self.major.formatter(val, i)
--> 921 for i, val in enumerate(majorLocs)]
922
923 minorLocs = self.minor.locator()
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\pandas\plotting\_converter.py in __call__(self, x, pos)
1106 else:
1107 fmt = self.formatdict.pop(x, '')
-> 1108 return Period(ordinal=int(x), freq=self.freq).strftime(fmt)
1109
1110
pandas/_libs/period.pyx in pandas._libs.period._Period.strftime()
pandas/_libs/period.pyx in pandas._libs.period.period_format()
pandas/_libs/period.pyx in pandas._libs.period._period_strftime()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 10: invalid continuation byte
Error in callback <function install_repl_displayhook.<locals>.post_execute at 0x00000213979E4840> (for post_execute):
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\pyplot.py in post_execute()
148 def post_execute():
149 if matplotlib.is_interactive():
--> 150 draw_all()
151
152 # IPython >= 2
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\_pylab_helpers.py in draw_all(cls, force)
148 for f_mgr in cls.get_all_fig_managers():
149 if force or f_mgr.canvas.figure.stale:
--> 150 f_mgr.canvas.draw_idle()
151
152 atexit.register(Gcf.destroy_all)
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\backend_bases.py in draw_idle(self, *args, **kwargs)
2059 if not self._is_idle_drawing:
2060 with self._idle_draw_cntx():
-> 2061 self.draw(*args, **kwargs)
2062
2063 def draw_cursor(self, event):
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in draw(self)
428 # if toolbar:
429 # toolbar.set_cursor(cursors.WAIT)
--> 430 self.figure.draw(self.renderer)
431 finally:
432 # if toolbar:
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\figure.py in draw(self, renderer)
1297
1298 mimage._draw_list_compositing_images(
-> 1299 renderer, self, artists, self.suppressComposite)
1300
1301 renderer.close_group('figure')
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe)
2435 renderer.stop_rasterizing()
2436
-> 2437 mimage._draw_list_compositing_images(renderer, self, artists)
2438
2439 renderer.close_group('axes')
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in draw(self, renderer, *args, **kwargs)
1131 renderer.open_group(__name__)
1132
-> 1133 ticks_to_draw = self._update_ticks(renderer)
1134 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
1135 renderer)
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in _update_ticks(self, renderer)
972
973 interval = self.get_view_interval()
--> 974 tick_tups = list(self.iter_ticks())
975 if self._smart_bounds and tick_tups:
976 # handle inverted limits
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in iter_ticks(self)
919 self.major.formatter.set_locs(majorLocs)
920 majorLabels = [self.major.formatter(val, i)
--> 921 for i, val in enumerate(majorLocs)]
922
923 minorLocs = self.minor.locator()
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in <listcomp>(.0)
919 self.major.formatter.set_locs(majorLocs)
920 majorLabels = [self.major.formatter(val, i)
--> 921 for i, val in enumerate(majorLocs)]
922
923 minorLocs = self.minor.locator()
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\pandas\plotting\_converter.py in __call__(self, x, pos)
1106 else:
1107 fmt = self.formatdict.pop(x, '')
-> 1108 return Period(ordinal=int(x), freq=self.freq).strftime(fmt)
1109
1110
pandas/_libs/period.pyx in pandas._libs.period._Period.strftime()
pandas/_libs/period.pyx in pandas._libs.period.period_format()
pandas/_libs/period.pyx in pandas._libs.period._period_strftime()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 10: invalid continuation byte
---------------------------------------------------------------------------
UnicodeDecodeError Traceback (most recent call last)
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\IPython\core\formatters.py in __call__(self, obj)
339 pass
340 else:
--> 341 return printer(obj)
342 # Finally look for special method names
343 method = get_real_method(obj, self.print_method)
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in <lambda>(fig)
236
237 if 'png' in formats:
--> 238 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
239 if 'retina' in formats or 'png2x' in formats:
240 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\IPython\core\pylabtools.py in print_figure(fig, fmt, bbox_inches, **kwargs)
120
121 bytes_io = BytesIO()
--> 122 fig.canvas.print_figure(bytes_io, **kw)
123 data = bytes_io.getvalue()
124 if fmt == 'svg':
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2214 orientation=orientation,
2215 dryrun=True,
-> 2216 **kwargs)
2217 renderer = self.figure._cachedRenderer
2218 bbox_inches = self.figure.get_tightbbox(renderer)
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in print_png(self, filename_or_obj, *args, **kwargs)
505
506 def print_png(self, filename_or_obj, *args, **kwargs):
--> 507 FigureCanvasAgg.draw(self)
508 renderer = self.get_renderer()
509 original_dpi = renderer.dpi
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\backends\backend_agg.py in draw(self)
428 # if toolbar:
429 # toolbar.set_cursor(cursors.WAIT)
--> 430 self.figure.draw(self.renderer)
431 finally:
432 # if toolbar:
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\figure.py in draw(self, renderer)
1297
1298 mimage._draw_list_compositing_images(
-> 1299 renderer, self, artists, self.suppressComposite)
1300
1301 renderer.close_group('figure')
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axes\_base.py in draw(self, renderer, inframe)
2435 renderer.stop_rasterizing()
2436
-> 2437 mimage._draw_list_compositing_images(renderer, self, artists)
2438
2439 renderer.close_group('axes')
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\image.py in _draw_list_compositing_images(renderer, parent, artists, suppress_composite)
136 if not_composite or not has_images:
137 for a in artists:
--> 138 a.draw(renderer)
139 else:
140 # Composite any adjacent images together
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\artist.py in draw_wrapper(artist, renderer, *args, **kwargs)
53 renderer.start_filter()
54
---> 55 return draw(artist, renderer, *args, **kwargs)
56 finally:
57 if artist.get_agg_filter() is not None:
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in draw(self, renderer, *args, **kwargs)
1131 renderer.open_group(__name__)
1132
-> 1133 ticks_to_draw = self._update_ticks(renderer)
1134 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
1135 renderer)
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in _update_ticks(self, renderer)
972
973 interval = self.get_view_interval()
--> 974 tick_tups = list(self.iter_ticks())
975 if self._smart_bounds and tick_tups:
976 # handle inverted limits
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in iter_ticks(self)
919 self.major.formatter.set_locs(majorLocs)
920 majorLabels = [self.major.formatter(val, i)
--> 921 for i, val in enumerate(majorLocs)]
922
923 minorLocs = self.minor.locator()
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\axis.py in <listcomp>(.0)
919 self.major.formatter.set_locs(majorLocs)
920 majorLabels = [self.major.formatter(val, i)
--> 921 for i, val in enumerate(majorLocs)]
922
923 minorLocs = self.minor.locator()
~\AppData\Local\Continuum\Anaconda3\lib\site-packages\pandas\plotting\_converter.py in __call__(self, x, pos)
1106 else:
1107 fmt = self.formatdict.pop(x, '')
-> 1108 return Period(ordinal=int(x), freq=self.freq).strftime(fmt)
1109
1110
pandas/_libs/period.pyx in pandas._libs.period._Period.strftime()
pandas/_libs/period.pyx in pandas._libs.period.period_format()
pandas/_libs/period.pyx in pandas._libs.period._period_strftime()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 10: invalid continuation byte
<matplotlib.figure.Figure at 0x2139d1ab630>
And the repr of ther string is :
'Periode du lundi 04/12/2017 17:11:41 au lundi 04/12/2017 21:59:59 \n Duree de 4h48m19s'
After spending too much time on google I can' find any clear answer. Any suggestions ?
I'm running Pandas 0.17.1 & Python 2.7.11 and I've got a pandas dataframe, shown below, with 3311 rows and 7 columns. It's fairly sparse as each column represents a sensor sampling at a diffferent rate (anywhere from 1Hz to 32Hz)
When I go to plot it using df.plot() I get a long callback (below) with a few MemoryErrors sprinkled in.
MemoryError Traceback (most recent call last)
<ipython-input-17-4f76bcc16520> in <module>()
----> 1 df.plot()
C:\Anaconda2\lib\site-packages\pandas\tools\plotting.pyc in __call__(self, x, y, kind, ax, subplots, sharex, sharey, layout, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, secondary_y, sort_columns, **kwds)
3669 fontsize=fontsize, colormap=colormap, table=table,
3670 yerr=yerr, xerr=xerr, secondary_y=secondary_y,
-> 3671 sort_columns=sort_columns, **kwds)
3672 __call__.__doc__ = plot_frame.__doc__
3673
C:\Anaconda2\lib\site-packages\pandas\tools\plotting.pyc in plot_frame(data, x, y, kind, ax, subplots, sharex, sharey, layout, figsize, use_index, title, grid, legend, style, logx, logy, loglog, xticks, yticks, xlim, ylim, rot, fontsize, colormap, table, yerr, xerr, secondary_y, sort_columns, **kwds)
2554 yerr=yerr, xerr=xerr,
2555 secondary_y=secondary_y, sort_columns=sort_columns,
-> 2556 **kwds)
2557
2558
C:\Anaconda2\lib\site-packages\pandas\tools\plotting.pyc in _plot(data, x, y, subplots, ax, kind, **kwds)
2382 plot_obj = klass(data, subplots=subplots, ax=ax, kind=kind, **kwds)
2383
-> 2384 plot_obj.generate()
2385 plot_obj.draw()
2386 return plot_obj.result
C:\Anaconda2\lib\site-packages\pandas\tools\plotting.pyc in generate(self)
991
992 for ax in self.axes:
--> 993 self._post_plot_logic_common(ax, self.data)
994 self._post_plot_logic(ax, self.data)
995
C:\Anaconda2\lib\site-packages\pandas\tools\plotting.pyc in _post_plot_logic_common(self, ax, data)
1119 ax.set_xticklabels(xticklabels)
1120 self._apply_axis_properties(ax.xaxis, rot=self.rot,
-> 1121 fontsize=self.fontsize)
1122 self._apply_axis_properties(ax.yaxis, fontsize=self.fontsize)
1123 elif self.orientation == 'horizontal':
C:\Anaconda2\lib\site-packages\pandas\tools\plotting.pyc in _apply_axis_properties(self, axis, rot, fontsize)
1167
1168 def _apply_axis_properties(self, axis, rot=None, fontsize=None):
-> 1169 labels = axis.get_majorticklabels() + axis.get_minorticklabels()
1170 for label in labels:
1171 if rot is not None:
C:\Anaconda2\lib\site-packages\matplotlib\axis.pyc in get_majorticklabels(self)
1159 def get_majorticklabels(self):
1160 'Return a list of Text instances for the major ticklabels'
-> 1161 ticks = self.get_major_ticks()
1162 labels1 = [tick.label1 for tick in ticks if tick.label1On]
1163 labels2 = [tick.label2 for tick in ticks if tick.label2On]
C:\Anaconda2\lib\site-packages\matplotlib\axis.pyc in get_major_ticks(self, numticks)
1288 'get the tick instances; grow as necessary'
1289 if numticks is None:
-> 1290 numticks = len(self.get_major_locator()())
1291 if len(self.majorTicks) < numticks:
1292 # update the new tick label properties from the old
C:\Anaconda2\lib\site-packages\pandas\tseries\converter.pyc in __call__(self)
901 vmin, vmax = vmax, vmin
902 if self.isdynamic:
--> 903 locs = self._get_default_locs(vmin, vmax)
904 else: # pragma: no cover
905 base = self.base
C:\Anaconda2\lib\site-packages\pandas\tseries\converter.pyc in _get_default_locs(self, vmin, vmax)
882
883 if self.plot_obj.date_axis_info is None:
--> 884 self.plot_obj.date_axis_info = self.finder(vmin, vmax, self.freq)
885
886 locator = self.plot_obj.date_axis_info
C:\Anaconda2\lib\site-packages\pandas\tseries\converter.pyc in _daily_finder(vmin, vmax, freq)
505 Period(ordinal=int(vmax), freq=freq))
506 span = vmax.ordinal - vmin.ordinal + 1
--> 507 dates_ = PeriodIndex(start=vmin, end=vmax, freq=freq)
508 # Initialize the output
509 info = np.zeros(span,
C:\Anaconda2\lib\site-packages\pandas\tseries\period.pyc in __new__(cls, data, ordinal, freq, start, end, periods, copy, name, tz, **kwargs)
181 else:
182 data, freq = cls._generate_range(start, end, periods,
--> 183 freq, kwargs)
184 else:
185 ordinal, freq = cls._from_arraylike(data, freq, tz)
C:\Anaconda2\lib\site-packages\pandas\tseries\period.pyc in _generate_range(cls, start, end, periods, freq, fields)
195 raise ValueError('Can either instantiate from fields '
196 'or endpoints, but not both')
--> 197 subarr, freq = _get_ordinal_range(start, end, periods, freq)
198 elif field_count > 0:
199 subarr, freq = _range_from_fields(freq=freq, **fields)
C:\Anaconda2\lib\site-packages\pandas\tseries\period.pyc in _get_ordinal_range(start, end, periods, freq, mult)
992 dtype=np.int64)
993 else:
--> 994 data = np.arange(start.ordinal, end.ordinal + 1, mult, dtype=np.int64)
995
996 return data, freq
MemoryError:
Error in callback <function post_execute at 0x000000000A2304A8> (for post_execute):
---------------------------------------------------------------------------
MemoryError Traceback (most recent call last)
C:\Anaconda2\lib\site-packages\matplotlib\pyplot.pyc in post_execute()
145 def post_execute():
146 if matplotlib.is_interactive():
--> 147 draw_all()
148
149 # IPython >= 2
C:\Anaconda2\lib\site-packages\matplotlib\_pylab_helpers.pyc in draw_all(cls, force)
148 for f_mgr in cls.get_all_fig_managers():
149 if force or f_mgr.canvas.figure.stale:
--> 150 f_mgr.canvas.draw_idle()
151
152 atexit.register(Gcf.destroy_all)
C:\Anaconda2\lib\site-packages\matplotlib\backend_bases.pyc in draw_idle(self, *args, **kwargs)
2024 if not self._is_idle_drawing:
2025 with self._idle_draw_cntx():
-> 2026 self.draw(*args, **kwargs)
2027
2028 def draw_cursor(self, event):
C:\Anaconda2\lib\site-packages\matplotlib\backends\backend_agg.pyc in draw(self)
472
473 try:
--> 474 self.figure.draw(self.renderer)
475 finally:
476 RendererAgg.lock.release()
C:\Anaconda2\lib\site-packages\matplotlib\artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
59 def draw_wrapper(artist, renderer, *args, **kwargs):
60 before(artist, renderer)
---> 61 draw(artist, renderer, *args, **kwargs)
62 after(artist, renderer)
63
C:\Anaconda2\lib\site-packages\matplotlib\figure.pyc in draw(self, renderer)
1131 dsu.sort(key=itemgetter(0))
1132 for zorder, a, func, args in dsu:
-> 1133 func(*args)
1134
1135 renderer.close_group('figure')
C:\Anaconda2\lib\site-packages\matplotlib\artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
59 def draw_wrapper(artist, renderer, *args, **kwargs):
60 before(artist, renderer)
---> 61 draw(artist, renderer, *args, **kwargs)
62 after(artist, renderer)
63
C:\Anaconda2\lib\site-packages\matplotlib\axes\_base.pyc in draw(self, renderer, inframe)
2302
2303 for zorder, a in dsu:
-> 2304 a.draw(renderer)
2305
2306 renderer.close_group('axes')
C:\Anaconda2\lib\site-packages\matplotlib\artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
59 def draw_wrapper(artist, renderer, *args, **kwargs):
60 before(artist, renderer)
---> 61 draw(artist, renderer, *args, **kwargs)
62 after(artist, renderer)
63
C:\Anaconda2\lib\site-packages\matplotlib\axis.pyc in draw(self, renderer, *args, **kwargs)
1104 renderer.open_group(__name__)
1105
-> 1106 ticks_to_draw = self._update_ticks(renderer)
1107 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
1108 renderer)
C:\Anaconda2\lib\site-packages\matplotlib\axis.pyc in _update_ticks(self, renderer)
947
948 interval = self.get_view_interval()
--> 949 tick_tups = [t for t in self.iter_ticks()]
950 if self._smart_bounds:
951 # handle inverted limits
C:\Anaconda2\lib\site-packages\matplotlib\axis.pyc in iter_ticks(self)
890 Iterate through all of the major and minor ticks.
891 """
--> 892 majorLocs = self.major.locator()
893 majorTicks = self.get_major_ticks(len(majorLocs))
894 self.major.formatter.set_locs(majorLocs)
C:\Anaconda2\lib\site-packages\pandas\tseries\converter.pyc in __call__(self)
901 vmin, vmax = vmax, vmin
902 if self.isdynamic:
--> 903 locs = self._get_default_locs(vmin, vmax)
904 else: # pragma: no cover
905 base = self.base
C:\Anaconda2\lib\site-packages\pandas\tseries\converter.pyc in _get_default_locs(self, vmin, vmax)
882
883 if self.plot_obj.date_axis_info is None:
--> 884 self.plot_obj.date_axis_info = self.finder(vmin, vmax, self.freq)
885
886 locator = self.plot_obj.date_axis_info
C:\Anaconda2\lib\site-packages\pandas\tseries\converter.pyc in _daily_finder(vmin, vmax, freq)
505 Period(ordinal=int(vmax), freq=freq))
506 span = vmax.ordinal - vmin.ordinal + 1
--> 507 dates_ = PeriodIndex(start=vmin, end=vmax, freq=freq)
508 # Initialize the output
509 info = np.zeros(span,
C:\Anaconda2\lib\site-packages\pandas\tseries\period.pyc in __new__(cls, data, ordinal, freq, start, end, periods, copy, name, tz, **kwargs)
181 else:
182 data, freq = cls._generate_range(start, end, periods,
--> 183 freq, kwargs)
184 else:
185 ordinal, freq = cls._from_arraylike(data, freq, tz)
C:\Anaconda2\lib\site-packages\pandas\tseries\period.pyc in _generate_range(cls, start, end, periods, freq, fields)
195 raise ValueError('Can either instantiate from fields '
196 'or endpoints, but not both')
--> 197 subarr, freq = _get_ordinal_range(start, end, periods, freq)
198 elif field_count > 0:
199 subarr, freq = _range_from_fields(freq=freq, **fields)
C:\Anaconda2\lib\site-packages\pandas\tseries\period.pyc in _get_ordinal_range(start, end, periods, freq, mult)
992 dtype=np.int64)
993 else:
--> 994 data = np.arange(start.ordinal, end.ordinal + 1, mult, dtype=np.int64)
995
996 return data, freq
MemoryError:
---------------------------------------------------------------------------
MemoryError Traceback (most recent call last)
C:\Anaconda2\lib\site-packages\IPython\core\formatters.pyc in __call__(self, obj)
335 pass
336 else:
--> 337 return printer(obj)
338 # Finally look for special method names
339 method = _safe_get_formatter_method(obj, self.print_method)
C:\Anaconda2\lib\site-packages\IPython\core\pylabtools.pyc in <lambda>(fig)
205
206 if 'png' in formats:
--> 207 png_formatter.for_type(Figure, lambda fig: print_figure(fig, 'png', **kwargs))
208 if 'retina' in formats or 'png2x' in formats:
209 png_formatter.for_type(Figure, lambda fig: retina_figure(fig, **kwargs))
C:\Anaconda2\lib\site-packages\IPython\core\pylabtools.pyc in print_figure(fig, fmt, bbox_inches, **kwargs)
115
116 bytes_io = BytesIO()
--> 117 fig.canvas.print_figure(bytes_io, **kw)
118 data = bytes_io.getvalue()
119 if fmt == 'svg':
C:\Anaconda2\lib\site-packages\matplotlib\backend_bases.pyc in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, **kwargs)
2176 orientation=orientation,
2177 dryrun=True,
-> 2178 **kwargs)
2179 renderer = self.figure._cachedRenderer
2180 bbox_inches = self.figure.get_tightbbox(renderer)
C:\Anaconda2\lib\site-packages\matplotlib\backends\backend_agg.pyc in print_png(self, filename_or_obj, *args, **kwargs)
525
526 def print_png(self, filename_or_obj, *args, **kwargs):
--> 527 FigureCanvasAgg.draw(self)
528 renderer = self.get_renderer()
529 original_dpi = renderer.dpi
C:\Anaconda2\lib\site-packages\matplotlib\backends\backend_agg.pyc in draw(self)
472
473 try:
--> 474 self.figure.draw(self.renderer)
475 finally:
476 RendererAgg.lock.release()
C:\Anaconda2\lib\site-packages\matplotlib\artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
59 def draw_wrapper(artist, renderer, *args, **kwargs):
60 before(artist, renderer)
---> 61 draw(artist, renderer, *args, **kwargs)
62 after(artist, renderer)
63
C:\Anaconda2\lib\site-packages\matplotlib\figure.pyc in draw(self, renderer)
1131 dsu.sort(key=itemgetter(0))
1132 for zorder, a, func, args in dsu:
-> 1133 func(*args)
1134
1135 renderer.close_group('figure')
C:\Anaconda2\lib\site-packages\matplotlib\artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
59 def draw_wrapper(artist, renderer, *args, **kwargs):
60 before(artist, renderer)
---> 61 draw(artist, renderer, *args, **kwargs)
62 after(artist, renderer)
63
C:\Anaconda2\lib\site-packages\matplotlib\axes\_base.pyc in draw(self, renderer, inframe)
2302
2303 for zorder, a in dsu:
-> 2304 a.draw(renderer)
2305
2306 renderer.close_group('axes')
C:\Anaconda2\lib\site-packages\matplotlib\artist.pyc in draw_wrapper(artist, renderer, *args, **kwargs)
59 def draw_wrapper(artist, renderer, *args, **kwargs):
60 before(artist, renderer)
---> 61 draw(artist, renderer, *args, **kwargs)
62 after(artist, renderer)
63
C:\Anaconda2\lib\site-packages\matplotlib\axis.pyc in draw(self, renderer, *args, **kwargs)
1104 renderer.open_group(__name__)
1105
-> 1106 ticks_to_draw = self._update_ticks(renderer)
1107 ticklabelBoxes, ticklabelBoxes2 = self._get_tick_bboxes(ticks_to_draw,
1108 renderer)
C:\Anaconda2\lib\site-packages\matplotlib\axis.pyc in _update_ticks(self, renderer)
947
948 interval = self.get_view_interval()
--> 949 tick_tups = [t for t in self.iter_ticks()]
950 if self._smart_bounds:
951 # handle inverted limits
C:\Anaconda2\lib\site-packages\matplotlib\axis.pyc in iter_ticks(self)
890 Iterate through all of the major and minor ticks.
891 """
--> 892 majorLocs = self.major.locator()
893 majorTicks = self.get_major_ticks(len(majorLocs))
894 self.major.formatter.set_locs(majorLocs)
C:\Anaconda2\lib\site-packages\pandas\tseries\converter.pyc in __call__(self)
901 vmin, vmax = vmax, vmin
902 if self.isdynamic:
--> 903 locs = self._get_default_locs(vmin, vmax)
904 else: # pragma: no cover
905 base = self.base
C:\Anaconda2\lib\site-packages\pandas\tseries\converter.pyc in _get_default_locs(self, vmin, vmax)
882
883 if self.plot_obj.date_axis_info is None:
--> 884 self.plot_obj.date_axis_info = self.finder(vmin, vmax, self.freq)
885
886 locator = self.plot_obj.date_axis_info
C:\Anaconda2\lib\site-packages\pandas\tseries\converter.pyc in _daily_finder(vmin, vmax, freq)
505 Period(ordinal=int(vmax), freq=freq))
506 span = vmax.ordinal - vmin.ordinal + 1
--> 507 dates_ = PeriodIndex(start=vmin, end=vmax, freq=freq)
508 # Initialize the output
509 info = np.zeros(span,
C:\Anaconda2\lib\site-packages\pandas\tseries\period.pyc in __new__(cls, data, ordinal, freq, start, end, periods, copy, name, tz, **kwargs)
181 else:
182 data, freq = cls._generate_range(start, end, periods,
--> 183 freq, kwargs)
184 else:
185 ordinal, freq = cls._from_arraylike(data, freq, tz)
C:\Anaconda2\lib\site-packages\pandas\tseries\period.pyc in _generate_range(cls, start, end, periods, freq, fields)
195 raise ValueError('Can either instantiate from fields '
196 'or endpoints, but not both')
--> 197 subarr, freq = _get_ordinal_range(start, end, periods, freq)
198 elif field_count > 0:
199 subarr, freq = _range_from_fields(freq=freq, **fields)
C:\Anaconda2\lib\site-packages\pandas\tseries\period.pyc in _get_ordinal_range(start, end, periods, freq, mult)
992 dtype=np.int64)
993 else:
--> 994 data = np.arange(start.ordinal, end.ordinal + 1, mult, dtype=np.int64)
995
996 return data, freq
MemoryError:
<matplotlib.figure.Figure at 0xdcbd1d0>
Interestingly, if I instead use
import matplotlib.pyploy as plt
plt.plot(df)
Then I actually get a plot, though the only column that shows anything on the graph is the bvp column, and it strangely has a 1e10 on the x-axis (even though, as mentioned above, the data series is only 3311 long and going up to 51.718750s).
Not too sure where to go from here. Any thoughts?