Scatter plot scaling in IPython Notebook

I am running IPython Notepad:

$ ipython notebook --pylab inline 

Can I scale graphics or images that are embedded?

eg. I have

 pylab.xlabel("Label X") pylab.ylabel("Label Y") pylab.scatter(range(2,15,2), [2, 3, 5, 7, 11, 13, 17], c="r") 

and I want him to be bigger.

Of course, I can try to manually change the parameters, for example.

 pylab.figure(figsize=(12, 8)) pylab.xlabel("Label X", fontsize = 20) pylab.ylabel("Label Y", fontsize = 20) pylab.scatter(range(2,15,2), [2, 3, 5, 7, 11, 13, 17], c="r", s=100) 

but it’s neither convenient nor accurate.

+4
source share
1 answer

In Python v2.7.4 with IPython v0.13 running with matplotlib v1.2.0 32-bit on Windows 8, I get a β€œhandle” in the lower right corner to manually resize (keep aspect ratio and resolution) the built-in graph, at least when used figure_format 'png' . As for the other formats, I am not sure, but it seems that this behavior is not when using 'svg' .

You can change the default value of figure_format by uncommenting the line starting with

# c.InlineBackend.figure_format

in the ipython_notebook_config.py configuration file in your IPython profile folder and set this parameter in any format that you want to use when starting the laptop, for example. 'png' .

If you want to change the default size for all embedded charts, you can change the c.InlineBackend.rc parameter in the same configuration file. If you, for example, want to set figsize to (12, 8) , you simply uncomment the corresponding line in the file, forcing it to say

c.InlineBackend.rc = {'figure.figsize': (12, 8)}

This option can also change the default fonts, dpi, etc.

+2
source

All Articles