Skip to content
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

small plots when rerunning the jupyter notebooks #36

Closed
blinkeye opened this issue Jun 15, 2017 · 13 comments
Closed

small plots when rerunning the jupyter notebooks #36

blinkeye opened this issue Jun 15, 2017 · 13 comments

Comments

@blinkeye
Copy link

If the jupyter notebooks are executed (again) the resulting plots are a lot smaller than before. I suggest to set the figure.figsize option in the preample.py to something like:

plt.rcParams['figure.figsize'] = 15, 10

@amueller
Copy link
Owner

amueller commented Jun 15, 2017 via email

@amueller
Copy link
Owner

amueller commented Jun 15, 2017 via email

@blinkeye
Copy link
Author

I've downloaded the most recent Anaconda3-4.4.0-Linux-x86_64.sh version:

$ conda info
Current conda install:

               platform : linux-64
          conda version : 4.3.21
       conda is private : False
      conda-env version : 4.3.21
    conda-build version : not installed
         python version : 3.6.1.final.0
       requests version : 2.14.2
       root environment : /home/rglauser/anaconda3  (writable)
    default environment : /home/rglauser/anaconda3
       envs directories : /home/rglauser/anaconda3/envs
                          /home/rglauser/.conda/envs
          package cache : /home/rglauser/anaconda3/pkgs
                          /home/rglauser/.conda/pkgs
           channel URLs : https://repo.continuum.io/pkgs/free/linux-64
                          https://repo.continuum.io/pkgs/free/noarch
                          https://repo.continuum.io/pkgs/r/linux-64
                          https://repo.continuum.io/pkgs/r/noarch
                          https://repo.continuum.io/pkgs/pro/linux-64
                          https://repo.continuum.io/pkgs/pro/noarch
            config file : None
             netrc file : None
           offline mode : False
             user-agent : conda/4.3.21 requests/2.14.2 CPython/3.6.1 Linux/4.4.0-79-generic debian/stretch/sid glibc/2.23    
                UID:GID : 1000:1000

Matplotlib version:

$ conda list matplotlib
#
matplotlib                2.0.2               np112py36_0  

Jupyter version:

$ conda list jupyter
#
jupyter                   1.0.0                    py36_3  
jupyter_client            5.0.1                    py36_0  
jupyter_console           5.1.0                    py36_0  
jupyter_core              4.3.0                    py36_0 

@blinkeye
Copy link
Author

I followed up on your hint about changing the DPI of the figures. That's a better solution, so I added

plt.rcParams['figure.dpi'] = 150

to preample.py

It looks to me like the default is figure.dpi = 100 which is a bit too small (and smaller than your initial figures).

@blinkeye blinkeye changed the title missing figure.figsize option in preample.py results in small plots small plots when rerunning the jupyter notebooks Jun 15, 2017
@amueller
Copy link
Owner

amueller commented Jun 15, 2017 via email

@blinkeye
Copy link
Author

blinkeye commented Jun 15, 2017

I started with 300 (like you use for saving images in preample.py):
plt.rcParams['savefig.dpi'] = 300
but then the plots are quite a bit bigger than in the original notebook you commited.

@amueller
Copy link
Owner

hm no, it shouldn't be. And that's not for saving images, that's also for showing them in the notebook. That's why I was asking about your notebook version. Depending on which version of the notebook you have, this is used or not.

@blinkeye
Copy link
Author

I posted the Matplotlib and Jupyter versions above. Do you mean the notebook version of your git repo? I'm using your master branch and the HEAD version, which is currently:

commit 409810c21060875d1c689713f6c42e0ce9cb2f1b (origin/master, origin/HEAD)
Merge: dbd8661 4f3c625
Author: Andreas Mueller <t3kcit@gmail.com>
Date:   Fri Jun 16 16:38:56 2017 +0200

    Merge pull request #43 from blinkeye/issue/37
    
    fix #37: display(panda DataFrame) throws a TypeError: 'module' object…

The notebooks all start with:

from preamble import *
%matplotlib inline

@amueller
Copy link
Owner

Oh sorry, overread the version.
My point was that plt.rcParams['savefig.dpi'] = 300 should affect the plots generated inside the notebook.

@amueller
Copy link
Owner

What's

conda list notebook

?

@amueller
Copy link
Owner

I'm running

notebook                  4.2.3                    py35_0  
jupyter                   1.0.0                    py35_3  
jupyter_client            4.4.0                    py35_0  
jupyter_console           5.0.0                    py35_0  
jupyter_core              4.2.0                    py35_0  

and they are affected, will have to look into it more deeply, also check out jupyter/notebook#2544

@amueller
Copy link
Owner

this is caused by:
ipython/ipykernel#176
ipython/ipython#9868

I'm replacing savefig with figure now, which should fix it in master in recent versions of ipykernel and ipython.

@amueller
Copy link
Owner

fixed in cccbbca

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

No branches or pull requests

2 participants