How to control layouts of individual plots within a graphics_array?

i like this post (click again to cancel)
1
i dont like this post (click again to cancel)

I am trying to plot two graphics side-by side from with an '@interact' function within the Sage notebook.

I define my graphics array and render it with the appropriate size as follows:

myGraphicsArray = graphics_array([myPlot1, myPlot2])

myGraphicsArray.show(figsize=[14,5])

This is fine, but how can I control features of the individual plots separately? (e.g. axis range, aspect ratio, maybe even relative sizes of the two plots etc.)

For now I have found a kludge workaround, which is to .show() the individual plots first of all (making them very small) within which I set the relevant layout parameters as follows:

myPlot1.show(ymin=-40,ymax=10,figsize=0.1) # note small figsize

myPlot2.show(xmin=-axisMax, xmax=axisMax, ymin=-axisMax, ymax=axisMax, aspect_ratio=1, figsize=0.1) # note small figsize

This is not ideal, as it plots them (albeit small) when I didn't really want to. But at least it allows me to control their respective layouts when they later appear within the graphics_array.

But is there a better way to do this?

asked Jun 09 '11

deebs67 gravatar image deebs67
13 1 1 6

updated Jun 09 '11

kcrisman gravatar image kcrisman
6639 13 66 150
This answer also exists at http://doxdrum.wordpress.com/2010/08/12/graphics-array-in-sagemath/. Unfortunately, I don't think there is a better way for now; graphics_array still needs a fair amount of work. See http://trac.sagemath.org/sage_trac/ticket/10657, http://trac.sagemath.org/sage_trac/ticket/11160, and http://trac.sagemath.org/sage_trac/ticket/10466, for instance. kcrisman (Jun 09 '11)
i like this answer (click again to cancel)
1
i dont like this answer (click again to cancel)

You can use myPlot1.set_axes_range to accomplish some of what you want, and I think there are other specific methods for setting particular options--hopefully the ones you're interested in :) Also, additional arguments given to graphics_array.show (e.g. axes and aspect_ratio) will be passed to each of the individual plots, so you can use that if there are some options you want to apply to all of the plots.

link

posted Jun 09 '11

niles gravatar image niles
3354 5 38 92
http://nilesjohnson.net/
Thanks for that. The tip about set_axes_range allowed me to remove one of the 'myPlotx.show()' operations. Unfortunately, since I want a different aspect_ratio between the two plots, I couldn't eliminate the other. deebs67 (Jun 09 '11)
If you use .save() instead of .show(), do the options still get set for graphics_array? niles (Jun 09 '11)
Actually, now I've done more experiments I realise that .show() wasn't actually helping me to control the aspect_ratio of myPlot2 within the graphics_array. I thought it did, but it was just that by default it gave me an aspect ratio close to 1.0, which by eye I assumed was exactly 1.0, but it wasn't. So I will get the aspect_ratio I ask for in the .show() operation, but it doesn't seem to influence what I get in the graphics_array.show(). As for .save(), in terms of what I see on the screen, I seem to get the same as .show(). The set_axes_range was the top tip which means that things work well enough for my purposes now without needing any myPlotx.show() statements. So thanks for that. deebs67 (Jun 09 '11)
well, glad I could help; as @kcrisman mentioned, graphics_array is unsatisfactory in many ways . . . niles (Jun 09 '11)

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]

Question tools

Tags:

Stats:

Asked: Jun 09 '11

Seen: 158 times

Last updated: Jun 09 '11

powered by ASKBOT version 0.7.22
Copyright Sage, 2010. Some rights reserved under creative commons license.