I have been using matplotlib a few days now and think I it is great
but recently I have gotten hung up on a problem plotting negative
numbers.
I am trying to plot data where the y values are all negative. When I
do this I get the No positive data to plot error. I have tracked it
down to the following two line is
/matplotlib/ticker.py:
if minpos<=0:
raise RuntimeError('No positive data to plot')
It looks like for some reason Matplotlib wants positive values when it
does the axis scaling. I commented out the two lines and it works
like a charm now. My question is, do these two lines of code serve a
useful purpose. Does commenting them out break something else or is
this a change that can be incorporated back into the matplotlib
source?
Full stack trace
---> 33 splot.plot(x1, y1, "g", x2, y2, "r")
/home/tdennist/lib/python/matplotlib/axes.py in plot(self, *args, **kwargs)
2524 lines.append(line)
2525 lines = [line for line in lines] # consume the generator
-> 2526 self.autoscale_view()
2527 return lines
2528
/home/tdennist/lib/python/matplotlib/axes.py in autoscale_view(self)
783
784 locator = self.yaxis.get_major_locator()
--> 785 self.set_ylim(locator.autoscale())
786
787
/home/tdennist/lib/python/matplotlib/ticker.py in autoscale(self)
819
820 if minpos<=0:
--> 821 raise RuntimeError('No positive data to plot')
822 if vmin<=0:
823 vmin = minpos
RuntimeError: No positive data to plot
In [50]: exampleReturns.logHistogramPlot([1,2,3,4,0], 100)