Reputation: 866
I am plotting with pandas plot() functions as follows:
In:
from matplotlib.pyplot import *
from datetime import date
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
fig, ax = subplots()
df['session_duration_seconds'].sort_index().value_counts().plot(figsize=(25,10), fontsize=24)
ax.legend(['session_duration_seconds'],fontsize=22)
ax.set_xlabel("Title", fontsize=22)
ax.set_ylabel("Title", fontsize=22)
ax.grid()
However, my plot looks very "behind" I would like to expand the plot in order to show in more detail the following section of the figure:
Out:
Thus, my question is how can I expand or getting more close with pandas plot over that portion of the image?
Upvotes: 1
Views: 14193
Reputation: 5437
Just an example to show how this could work:
df = pd.DataFrame({'Values': [1000, 1, 2, 3 , 4 , 2, 5]})
df.plot()
Now let's restrict the y-range
import matplotlib.pyplot as plt
df.plot()
plt.ylim(0, 10)
and we see the details of the curve.
Note that the curve is so steep near 0 due to the huge slope induced by the first y-value of 1000.
Also you can just scale the y-axis directly form within pandas plot functions:
df.plot(logy=True)
Upvotes: 3