-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Grid=True option in plot functions overrides user settings #3188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Marking as 0.12, though I'm not sure that will happen unless someone steps up |
I want to work on this but I did not find any tests of plotting stuff. Should we add a test_plotting module? |
|
Also |
Came here to file this same issue so +1. |
While not all plotting functions have |
take |
Hi everyone! I would like to take this issue, but I can't reproduce it for fresh built version. import numpy as np
import pandas as pd
from matplotlib import pyplot as plt
import matplotlib as mpl
print(pd.__version__)
print("mpl.rcParams['axes.grid']", mpl.rcParams['axes.grid'])
df = pd.DataFrame(columns=["A", "B"], data=np.random.rand(100,2))
df.plot(grid=True)
print("mpl.rcParams['axes.grid']", mpl.rcParams['axes.grid'])
f = plt.figure()
_ = f.gca().plot(np.random.rand(100))
# output
1.4.0.dev0+921.gef9416c51c
mpl.rcParams['axes.grid'] False
mpl.rcParams['axes.grid'] False As I can see it was appeared in 0.12 first time, but looks like now every thing is fine. I also have tried set rc.axes.grid as True in the file and then run the same script but with explicit grid=False argument and without it. Works correct: when grid=False it doesn't show grid despite of the rc params and in case of grid doesn't specified it has the same behavior as in file specified i.e. grid will be shown. |
take |
@bdrum If I understand correctly, the issue is that if you have a |
@Dr-Irv thanks for clarification. import numpy as np
import pandas as pd
import matplotlib as mpl
print(pd.__version__)
print("mpl.rcParams['axes.grid']", mpl.rcParams['axes.grid'])
df = pd.DataFrame(columns=["A", "B"], data=np.random.rand(100,2))
df.plot()
# output
1.4.0.dev0+921.gef9416c51c
mpl.rcParams['axes.grid'] True and revert back to grid false in rc file: import numpy as np
import pandas as pd
import matplotlib as mpl
print(pd.__version__)
print("mpl.rcParams['axes.grid']", mpl.rcParams['axes.grid'])
df = pd.DataFrame(columns=["A", "B"], data=np.random.rand(100,2))
df.plot()
# output
1.4.0.dev0+921.gef9416c51c
mpl.rcParams['axes.grid'] False According to discussion above, I can try to add some checks in tests |
If you can create a test that verifies this in a PR, that would be great. |
@bdrum Thanks. I will close this as a result of your discovery. |
The plotting functions on DataFrames always have grid=True. This overrides user settings in matplotlibrc.
If you have to created a desired default plot style with the rc file, you want every plot to show with this style unless otherwise specified.
Because pandas overrides this setting you have to manually set the grid option every time.
A better behaviour would be for Pandas not to override any plot styles by default.
The text was updated successfully, but these errors were encountered: