[IPython-dev] notebook plots via javascript

Brian Granger ellisonbg at gmail.com
Thu Jun 7 19:10:58 EDT 2012


Bob,

This is great.  In my work on this branch to make svg images resizable:

https://github.com/ipython/ipython/pull/1832

I noticed that the svg created by matplotlib was pixelated.

On Thu, Jun 7, 2012 at 2:50 PM, Bob McElrath <bob+ipython at mcelrath.org> wrote:
> I really want to improve the figure quality of the notebook.  So, I made a stab
> in this direction by changing the default figure to SVG, making them
> transparent, and improving their quality a bit.  You can see it in my branch:
>    https://github.com/mcelrath/ipython/tree/svg_figures

I didn't play with this yet, but left some comments.  Maybe open up
pull request for this just to have a good place to discuss things.
There is another question about the svg that matplotlib generates.
Currently, the main svg tag has a width and height that is specified
in pts.  I am finding that in the notebook this is very difficult to
deal with.  Do you think it is possible to specify the width/height in
the svg tag in pixels?

> While this isn't interactive javascript yet, we can begin attaching some
> javascript to the SVG DOM elements.

And the figure resizing in my branch above would be a good start.

> It turns out to get decent quality SVG figures, you have to set the
> figure.figsize fairly high.  SVG doesn't know about or obey the DPI setting, but
> the low value of figsize was causing some pixelation, which is why the SVG
> figures produced by the notebook looked worse than the PNG figures.
>
> --
> Cheers, Bob McElrath
>
> "The individual has always had to struggle to keep from being overwhelmed by
> the tribe.  If you try it, you will be lonely often, and sometimes frightened.
> But no price is too high to pay for the privilege of owning yourself."
>    -- Friedrich Nietzsche
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev



-- 
Brian E. Granger
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu and ellisonbg at gmail.com



More information about the IPython-dev mailing list