matplotlib's rcParams['figure.figsize'] lost between cells
See original GitHub issueI can set the size of figures like this:
# In[1]:
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
x = np.linspace(0, 6, 200)
y = np.sin(x)
# In[2]:
# Set figures to be large
plt.rcParams['figure.figsize'] = (10, 10)
plt.plot(x, y);
In the above example, the rcParams[‘figure.figsize’] is set in cell 2 (where the plot is made), and the figure is correctly sized to 10 x 10.
However, if I try setting the figure size in cell 1, it is ignored. The figure remains the default size…
# In[1]:
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
x = np.linspace(0, 6, 200)
y = np.sin(x)
# Set figures to be large
plt.rcParams['figure.figsize'] = (10, 10)
# In[2]:
plt.plot(x, y);
Settings in rcParams used to work. It must be an updated version of ipython or matplotlib which has broken the memory of rcParams between cells.
The output of pandas.show_versions() is:
INSTALLED VERSIONS
------------------
commit: None
python: 3.6.4.final.0
python-bits: 64
OS: Windows
OS-release: 10
machine: AMD64
processor: Intel64 Family 6 Model 94 Stepping 3, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None
pandas: 0.22.0
pytest: 3.2.1
pip: 9.0.1
setuptools: 36.5.0.post20170921
Cython: 0.26.1
numpy: 1.13.3
scipy: 1.0.0
pyarrow: None
xarray: None
IPython: 6.2.1
sphinx: 1.6.3
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2017.2
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.2
feather: None
matplotlib: 2.2.2
openpyxl: 2.4.8
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 0.9.8
lxml: 3.8.0
bs4: 4.6.0
html5lib: 0.999999999
sqlalchemy: 1.1.13
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
Issue Analytics
- State:
- Created 5 years ago
- Reactions:8
- Comments:14 (3 by maintainers)
Top Results From Across the Web
How do I change the size of figures drawn with Matplotlib?
plot() for example, you can set a tuple with width and height. import matplotlib.pyplot as plt plt.rcParams["figure.figsize"] = (20, ...
Read more >matplotlib.pyplot.figure — Matplotlib 3.1.0 documentation
If this figure does not exists, create it and returns it. If num is a string, the window title will be set to...
Read more >rcParams doesn't work the first time - Notebook
If I create two cells: #%% 1st Cell import matplotlib as mpl from matplotlib import ... rcParams['figure.figsize'] = (12, 8) #%% 2nd cell...
Read more >Chapter 4. Visualization with Matplotlib - O'Reilly
Selection from Python Data Science Handbook [Book] ... types of flowers that has had the size of its petals and sepals carefully measured...
Read more >Python Plotting With Matplotlib (Guide)
Almost all functions from pyplot, such as plt.plot() , are implicitly either referring to an existing current Figure and current Axes, or creating...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For me this happens if I put
import matplotlib.pylab as plt
in the same cell asplt.rcParams['figure.figsize'] = …
but not if I put it in two cells.For me it is even weirder:
But if I run everything again, it works: