Skip to content

Problem while changing current figure size in Jupyter notebook #11253

@Pibmy

Description

@Pibmy

Bug report

Bug summary

In Jupyter Notebook, the problem occurs when dynamicaly changing the size of a ploted figure. The image is cropped and not totally displayed. (See code and example below)

Code for reproduction

1st cell > import declaration:

%matplotlib notebook

import pandas as pd
import matplotlib.pyplot as plt

2nd cell > declaring dataframe and plot:

df = pd.DataFrame([1,2,3,4,6])
df.plot()

capture0

3rd cell > changing current figsize:

fig = plt.gcf()
fig.set_size_inches(5,5)

capture1

As seen on the second screenshot the image is cropped and I had to manualy resize it for a good display.

Note

  • the problem doesn't occur when ploting and changing size are in the same notebook cell
  • the problem doesn't occur when the zoom lvl of my browser is between 50% 70%

Matplotlib version

  • Operating system: 'Windows 10 Profesionnel' - v1709 - vsystem 16299.371
  • Browser : 'Firefox 59.0.3 (64 bits)'
  • Matplotlib version: '2.1.0'
  • Matplotlib backend (print(matplotlib.get_backend())): nbAgg
  • Python version: '3.6.3 |Anaconda, Inc.| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)]'
  • Jupyter version (if applicable): '4.4.0'
  • Other libraries: pandas version '0.20.3'

Installation by default with anaconda with version 'conda 4.3.30'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions