[IPython-dev] Resizable SVG and other images?

Matthias BUSSONNIER bussonniermatthias at gmail.com
Sun Jan 5 06:52:07 EST 2014


Le 4 janv. 2014 à 22:19, Andrew Gibiansky a écrit :

> Hello all,
> 
> I am using display_data to publish SVG figures in the IPython notebook, but am noticing that they cannot be resized (unlike similar PNG figures). Is there a way to make these SVGs resizable?

IIRC we did not made SVG resizable because it was not reliable. 
One solution would be to make svg with/heigh of 100% and wrap them in a resizable div, but it is not reliable is svg have absolute size.
last solution would be to put them in img tag and base64 encoded in the src attribute then use same logic that png; but not sure it works.

> 
> When I generate figures to publish in the notebook, I have to decide on the backend what size they are. However I do not know what size screen the user has, so as a result the figures can look either too small or too large on some users' screens if I just pick a reasonable default for myself. Is there a way to make it so that IPython notebook will automatically choose a reasonable size to display the PNGs at? 
> 
> It seems that Matplotlib somehow does this, but I do not know how.

I suppose in svg size can be expressed as em,pt,cm that will scale correctly because the brewer know he xx/px ratio ?

-- 
M


More information about the IPython-dev mailing list