I'm trying to set margins so all my points are visible when plotting with matplotlib but its doesn't seem to correctly add them. Below is my code and output.
I'm using IPython with the %matplotlib magic command.
Is there something that I'm doing obviously wrong?
import matplotlib.pyplot as plt
import pandas as pd
d = pd.DataFrame(pd.Series(range(10))*2)
a = d.plot(style = "o-")
a.set_axis_bgcolor('g')
a.margins(.05)
see the following documentation for set_ylim and set_xlim http://matplotlib.org/api/axes_api.html?highlight=set_xlim
d = pd.DataFrame(pd.Series(range(10))*2)
a = d.plot(style = "o-")
a.set_axis_bgcolor('g')
a.set_ylim([-1,19])
a.set_xlim([-1,11])
a.margins(.05)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With