Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
0.7.3
-
None
-
None
Description
In Zeppelin, Python interpreter gives error when I try to plot some simple data using matplotlib hist() function using log scale.
For example, the following code:
%spark.pyspark import matplotlib.pyplot as plt plt.hist(x=[1,1,2,5,6,7,8], log=True)
raises the following error:
Traceback (most recent call last): File "/tmp/zeppelin_pyspark-6974052710629836805.py", line 367, in <module> raise Exception(traceback.format_exc()) Exception: Traceback (most recent call last): File "/tmp/zeppelin_pyspark-6974052710629836805.py", line 360, in <module> exec(code, _zcUserQueryNameSpace) File "<stdin>", line 2, in <module> File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/pyplot.py", line 3081, in hist stacked=stacked, data=data, **kwargs) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/__init__.py", line 1898, in inner return func(ax, *args, **kwargs) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_axes.py", line 6279, in hist color=c, **{bottom_kwarg: bottom}) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/__init__.py", line 1898, in inner return func(ax, *args, **kwargs) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_axes.py", line 2019, in bar self.set_yscale('log', nonposy='clip') File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 3238, in set_yscale ax.yaxis._set_scale(value, **kwargs) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/axis.py", line 710, in _set_scale self._scale.set_default_locators_and_formatters(self) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/scale.py", line 249, in set_default_locators_and_formatters axis.set_major_locator(LogLocator(self.base)) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/axis.py", line 1543, in set_major_locator self.stale = True File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/artist.py", line 279, in stale self.stale_callback(self, val) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/artist.py", line 76, in _stale_axes_callback self.axes.stale = val File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/artist.py", line 279, in stale self.stale_callback(self, val) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/figure.py", line 56, in _stale_figure_callback self.figure.stale = val File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/artist.py", line 279, in stale self.stale_callback(self, val) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/pyplot.py", line 576, in _auto_draw_if_interactive fig.canvas.draw_idle() File "/opt/zeppelin-0.7.3-bin-all/interpreter/lib/python/backend_zinline.py", line 136, in draw_idle self.draw(*args, **kwargs) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 464, in draw self.figure.draw(self.renderer) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/artist.py", line 63, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/figure.py", line 1144, in draw renderer, self, dsu, self.suppressComposite) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/image.py", line 139, in _draw_list_compositing_images a.draw(renderer) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/artist.py", line 63, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/axes/_base.py", line 2426, in draw mimage._draw_list_compositing_images(renderer, self, dsu) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/image.py", line 139, in _draw_list_compositing_images a.draw(renderer) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/artist.py", line 63, in draw_wrapper draw(artist, renderer, *args, **kwargs) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/axis.py", line 1136, in draw ticks_to_draw = self._update_ticks(renderer) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/axis.py", line 969, in _update_ticks tick_tups = [t for t in self.iter_ticks()] File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/axis.py", line 912, in iter_ticks majorLocs = self.major.locator() File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/ticker.py", line 1930, in __call__ return self.tick_values(vmin, vmax) File "/home/zeppelin/anaconda2/lib/python2.7/site-packages/matplotlib/ticker.py", line 1956, in tick_values "Data has no positive values, and therefore can not be " ValueError: Data has no positive values, and therefore can not be log-scaled.
I get the very same error even if I use python interpreter, instead of pyspark.
If I remove log scale everything works fine.
I did not find any open issue related to this problem, except the following link that might be related:
https://stackoverflow.com/questions/48440882/python-plotting-time-series-data-in-zeppelin-causes-valueerror-alternate-times