Skip to content

Remove image resizer - #8098

Merged
minrk merged 1 commit into
masterfrom
unknown repository
Mar 24, 2015
Merged

minrk merged 1 commit into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Mar 20, 2015

Copy link
Copy Markdown

This PR removes the image resizer for images. Removing the resizer helps a lot to solve the image overflow issue in #7701. Related PR: #8062.

Before:
screenshot from 2015-03-20 10 48 02

After:

screenshot from 2015-03-20 10 49 48

@jdfreder

Copy link
Copy Markdown
Contributor

-1 because I like this feature.

@ghost

ghost commented Mar 24, 2015

Copy link
Copy Markdown
Author

I don't have anything against this feature but it is causing significant issues and preventing us from implementing solutions that are trivial CSS fixes (e.g. something like this as a fix to #7701).

Furthermore, the current jquery-ui .resizer is not responsive-friendly, so we can't have a fully responsive (or even fluid) layout. That is by far the more important consideration in terms of user experience and as a foundation to prevent more related issues.

Finally, the resizer (I think) is not widely used or even easily recognized. Its removal is not likely to disrupt the workflow of users. Actually, I would worry about excessively using the resizer to obtain larger images instead of doing it programmatically.

minrk added a commit that referenced this pull request Mar 24, 2015
@minrk
minrk merged commit 62ec644 into ipython:master Mar 24, 2015
@minrk

minrk commented Mar 24, 2015

Copy link
Copy Markdown
Member

We are going to merge all the things - remove resize, add simpler 'expand to original' from #8062, and scroll the output_subarea on overflow.

@minrk minrk added this to the 3.1 milestone Mar 30, 2015
minrk added a commit that referenced this pull request Mar 30, 2015
This PR removes the image resizer for images. Removing the resizer helps a lot to solve the image overflow issue in #7701. Related PR: #8062.

Before:
![screenshot from 2015-03-20 10 48 02](https://cloud.githubusercontent.com/assets/599274/6756414/624077fa-ceef-11e4-8df2-53d0bdf7338e.png)

...
@cancan101

Copy link
Copy Markdown

Given that the resize handle is now gone, how do I make the image render larger? I am trying this and it does not seem to work:

current = %config InlineBackend.rc
current['figure.figsize'] = (9,6)
%config InlineBackend.rc = current

@ghost

ghost commented Apr 24, 2015

Copy link
Copy Markdown
Author

@cancan101

I think this is a question related to matplotlib. You can simply use:

import matplotlib
%matplotlib inline

matplotlib.rcParams['figure.figsize'] = (12,9)

@cancan101

Copy link
Copy Markdown

That seems to work. What then does InlineBackend.rc['figure.figsize'] even mean?

@Carreau

Carreau commented Apr 24, 2015

Copy link
Copy Markdown
Member

that tells the default size for the figure when using inline figures with
matplotlib.

On Fri, Apr 24, 2015 at 9:53 AM, Alex Rothberg [email protected]
wrote:

That seems to work. What then does InlineBackend.rc['figure.figsize']
even mean?

—
Reply to this email directly or view it on GitHub
#8098 (comment).

@cancan101

Copy link
Copy Markdown

I have %matplotlib inline set and am plotting using:

    import matplotlib.pyplot as plt
    plt.imshow(img)

and InlineBackend.rc['figure.figsize'] does not seem to do anything.

@Carreau

Carreau commented Apr 24, 2015

Copy link
Copy Markdown
Member

you can try :

import matplotlib
matplotlib.rcParams['figure.figsize'] = [sizex, sizey]

but anyway the better way to do it is to learn the OO way of matplotlib.

On Fri, Apr 24, 2015 at 10:02 AM, Alex Rothberg [email protected]
wrote:

I have %matplotlib inline set and am plotting using:

import matplotlib.pyplot as plt
plt.imshow(img)

and InlineBackend.rc['figure.figsize'] does not seem to do anything.

—
Reply to this email directly or view it on GitHub
#8098 (comment).

@cancan101

Copy link
Copy Markdown

OO way?

@Carreau

Carreau commented Apr 24, 2015

Copy link
Copy Markdown
Member

Object oriented. Create figure and axis references and manipute them.

%matplotlib inline
import matplotlib.pyplot as plt
fig, ax = plt.subplots(1,1)
fig.set_figwidth(7)
fig.set_figheight(11)
ax.plot(range(10))

@ghost

ghost commented Apr 24, 2015

Copy link
Copy Markdown
Author

If I understood @cancan101 's question correctly, I think he wants to set the image size for all figures in the notebook. Otherwise, there is no need to be manipulating global variables.

By the way, it is easier to do this:

fig, ax = plt.subplots(figsize=(7,11))
ax.plot(range(10))

@Quantum-cross

Copy link
Copy Markdown

I really really miss the resizer!!!

Changing the figsize is NOT an alternative to the resize handle.

fig, ax = plt.subplots(figsize=(8,10))
ax.plot(range(10))
plt.show()

fig, ax = plt.subplots(figsize=(4,5))
ax.plot(range(10))
plt.show()

The font size and line widths are the same, but the plot is twice as big. When I'm trying to make publication ready figures, it is nice so set the figsize that will put the text in proportion with the plot, and use the resize handle to get a closer look.

Is there another solution to quickly and easily scale figures? Like actually scale everything? Or do I have to output to a file and view it from there now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants