I am quite new to Seaborn
, and I am in the process of learning it. However, when I try to run my code, the plot never shows up and instead, the program ends.
This is my code:
import matplotlib.pyplot as plt import seaborn as sns import warnings as wrn from np.Importing_data import stats plt.rcParams(['figure.figsize']l = 8, 4 wrn.filterwarnings('ignore') sns.distplot(stats['InternetUsers'], bins=30) # sns.boxplot(data=stats, x='IncomeGroup', y='BirthRate') plt.show(sns)
The 4th line of code is importing the data. This is what I get when running the code normally. The error appears in the Python console, but I do not think this is causing the plot not to be shown.
Traceback (most recent call last): File "C:/Users/Ratnes.Ratnes-LT/PycharmProjects/demo-rs/np/Seaborn.py", line 11, in <module> plt.show(sns) File "C:UsersRatnes.Ratnes-LTPycharmProjectsdemo-rsvenvlibsite-packagesmatplotlibpyplot.py", line 354, in show return _backend_mod.show(*args, **kwargs) TypeError: show() takes 1 positional argument but 2 were given Process finished with exit code 1
If I try and run this on the python console, the code works as expected.
This is the result.
The matplotlib plots do show up but the seaborn ones don’t. If anyone’s got any solutions, please post on here.
Advertisement
Answer
Please read the document of matplotlib.pyplot.show. The only argument that can be passed as an argument is a bool value which indicates whether you need interactive or non interactive mode (default value is None), which is basically what your error says as well.