For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
cerebro.plot() function with jupyter returns ValueErrror
-
Hi I am getting this backtrace when I try and plot withing jupyter.
Any ideas?
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) <ipython-input-256-b2b5b6d55a52> in <module> 6 cerebro.run() 7 cerebro.broker.getvalue() ----> 8 cerebro.plot() /data/NFS/akhil/python-env/lib64/python3.6/site-packages/backtrader/cerebro.py in plot(self, plotter, numfigs, iplot, start, end, width, height, dpi, tight, use, **kwargs) 989 rfig = plotter.plot(strat, figid=si * 100, 990 numfigs=numfigs, iplot=iplot, --> 991 start=start, end=end, use=use) 992 # pfillers=pfillers2) 993 /data/NFS/akhil/python-env/lib64/python3.6/site-packages/backtrader/plot/plot.py in plot(self, strategy, figid, numfigs, iplot, start, end, **kwargs) 218 downinds=self.dplotsdown[ind]) 219 --> 220 self.plotdata(data, self.dplotsover[data]) 221 222 for ind in self.dplotsdown[data]: /data/NFS/akhil/python-env/lib64/python3.6/site-packages/backtrader/plot/plot.py in plotdata(self, data, indicators) 667 if self.pinf.sch.volume and voloverlay: 668 volplot = self.plotvolume( --> 669 data, opens, highs, lows, closes, volumes, vollabel) 670 axvol = self.pinf.daxis[data.volume] 671 ax = axvol.twinx() /data/NFS/akhil/python-env/lib64/python3.6/site-packages/backtrader/plot/plot.py in plotvolume(self, data, opens, highs, lows, closes, volumes, label) 609 610 volylim /= self.pinf.sch.volscaling --> 611 ax.set_ylim(0, volylim, auto=True) 612 else: 613 # plot a legend /data/NFS/akhil/python-env/lib64/python3.6/site-packages/matplotlib-3.2.1-py3.6-linux-x86_64.egg/matplotlib/axes/_base.py in set_ylim(self, bottom, top, emit, auto, ymin, ymax) 3573 self._process_unit_info(ydata=(bottom, top)) 3574 bottom = self._validate_converted_limits(bottom, self.convert_yunits) -> 3575 top = self._validate_converted_limits(top, self.convert_yunits) 3576 3577 if bottom is None or top is None: /data/NFS/akhil/python-env/lib64/python3.6/site-packages/matplotlib-3.2.1-py3.6-linux-x86_64.egg/matplotlib/axes/_base.py in _validate_converted_limits(self, limit, convert) 3099 if (isinstance(converted_limit, Real) 3100 and not np.isfinite(converted_limit)): -> 3101 raise ValueError("Axis limits cannot be NaN or Inf") 3102 return converted_limit 3103 ValueError: Axis limits cannot be NaN or Inf --------------------------------------------------------------------------- ValueError Traceback (most recent call last) /data/NFS/akhil/python-env/lib64/python3.6/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) /data/NFS/akhil/python-env/lib64/python3.6/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)) /data/NFS/akhil/python-env/lib64/python3.6/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': /data/NFS/akhil/python-env/lib64/python3.6/site-packages/matplotlib-3.2.1-py3.6-linux-x86_64.egg/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, **kwargs) 2103 orientation=orientation, 2104 bbox_inches_restore=_bbox_inches_restore, -> 2105 **kwargs) 2106 finally: 2107 if bbox_inches and restore_bbox: /data/NFS/akhil/python-env/lib64/python3.6/site-packages/matplotlib-3.2.1-py3.6-linux-x86_64.egg/matplotlib/backends/backend_agg.py in print_png(self, filename_or_obj, metadata, pil_kwargs, *args, **kwargs) 512 } 513 --> 514 FigureCanvasAgg.draw(self) 515 if pil_kwargs is not None: 516 from PIL import Image /data/NFS/akhil/python-env/lib64/python3.6/site-packages/matplotlib-3.2.1-py3.6-linux-x86_64.egg/matplotlib/backends/backend_agg.py in draw(self) 386 Draw the figure using the renderer. 387 """ --> 388 self.renderer = self.get_renderer(cleared=True) 389 # Acquire a lock on the shared font cache. 390 with RendererAgg.lock, \ /data/NFS/akhil/python-env/lib64/python3.6/site-packages/matplotlib-3.2.1-py3.6-linux-x86_64.egg/matplotlib/backends/backend_webagg_core.py in get_renderer(self, cleared) 224 if need_new_renderer: 225 self._renderer = backend_agg.RendererAgg( --> 226 w, h, self.figure.dpi) 227 self._last_renderer = backend_agg.RendererAgg( 228 w, h, self.figure.dpi) /data/NFS/akhil/python-env/lib64/python3.6/site-packages/matplotlib-3.2.1-py3.6-linux-x86_64.egg/matplotlib/backends/backend_agg.py in __init__(self, width, height, dpi) 90 self.width = width 91 self.height = height ---> 92 self._renderer = _RendererAgg(int(width), int(height), dpi) 93 self._filter_renderers = [] 94 ValueError: Image size of 191472350x251 pixels is too large. It must be less than 2^16 in each direction. <Figure size 432x288 with 3 Axes>