Issue
Plotting with a symmetric log scale using pandas gives excessively wide axis limits.
Set up some dummy data and make a plot:
>>> x = [0, 1]
>>> y = [-11825.251019, -470.310618]
>>> plt.plot(x, y)
>>> plt.yscale('symlog')
>>> plt.ylim()
(-13894.13926670043, -400.27964366818765)
So far, so good. Now try the same thing with pandas:
>>> pd.Series(y).plot()
>>> plt.yscale('symlog')
>>> plt.ylim()
(-12392.998039049999, 97.43640205000008)
Why is the upper axis limit positive?
Solution
Series.plot
has the logy
parameter, and using logy='sym'
produces the same ylimits as pure matplotlib.
pd.Series(y).plot(logy='sym')
Answered By - BigBen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.