Ask Your Question
1

Floating plots in notebook?

asked 2015-04-17 00:40:52 +0200

Eugene gravatar image

Is there a way to make plots float? Like in floating divs? Say, I have a two plots:

plot(sin, 0, pi).show()
plot(cos, 0, pi).show()

Right now this code produces two pictures, one on top of the other:

--------
|plot 1|
--------
|plot 2|
--------

But my screen is wide enough to show them alongside like:

----------------
|plot 1| plot 2|
----------------

It would be nice to have an option allowing to produce a few floating divs from pictures.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2015-04-19 13:43:03 +0200

ndomes gravatar image
html.table([[plot(sin,-pi,pi),plot(cos,-pi,pi)]])
edit flag offensive delete link more

Comments

Thanks for the answer too! I have the same question about approach with html, is there a way to use additional parameters, like axis labels to ticks? Again, preferably separately for each plot.

Eugene gravatar imageEugene ( 2015-04-19 17:51:51 +0200 )edit

You can use further options with the plot command, for example:

html.table([[plot(sin,-pi,pi,axes_labels=['X','Y']),plot(cos,-pi,pi,gridlines=True)]])
ndomes gravatar imagendomes ( 2015-04-19 18:43:56 +0200 )edit
1

answered 2015-04-17 01:15:36 +0200

tmonteil gravatar image

Not playing with html, but glueing the plots in a single one, you can use GraphicsArray:

sage: from sage.plot.graphics import GraphicsArray
sage: GraphicsArray([plot(sin, 0, pi), plot(cos, 0, pi)])
Launched png viewer for Graphics Array of size 1 x 2
edit flag offensive delete link more

Comments

Thanks for the answer! But in that case where do I put additional parameters like, for example, axis_labels? It would be nice to be able to control additional parameters separately for each plot. I tried to put them in GraphicsArray.show but that cause an error:

RuntimeError: should never launch viewer in embedded mode

and also affected all plots.

Eugene gravatar imageEugene ( 2015-04-19 17:50:31 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-04-17 00:40:52 +0200

Seen: 354 times

Last updated: Apr 19 '15