Ask Your Question
0

graph formatting issue in graphics array

asked 2013-02-07 09:23:34 +0200

anonymous user

Anonymous

updated 2013-02-07 09:48:18 +0200

kcrisman gravatar image

Hi,

I would like to layout my set of phase plots in an array. However I am having issues with getting font size correct, and axes labels to show up on all the graphs. Also my distance/velocity/acceleration phase plots are showing up as not being an graphic so I am unable to add them to the array.

code:

xy = zip(result[:,0],result[:,2])
uv = zip(result[:,1],result[:,3])
dudv = zip(udott,vdott)
tx = zip(ts,result[:,0])
ty = zip(ts,result[:,2])
tu = zip(ts,result[:,1])
tv = zip(ts,result[:,3])
tudot = zip(ts,udott)
tvdot = zip(ts,vdott)
xu = zip(result[:,0],result[:,1])
yv = zip(result[:,2],result[:,3])
udu = zip(result[:,1],udott)
vdv = zip(result[:,3],vdott)
xdu = zip(result[:,0],udott)
ydv = zip(result[:,2],vdott)
xudu = zip(result[:,0],result[:,1],udott)
yvdv = zip(result[:,2],result[:,3],vdott)

pltx = line(tx, color = 'red', thickness = 0.05)
plty = line(ty, color = 'orange', thickness = 0.05)
pltxy = line(xy, color = 'yellow', thickness = 0.05)
pltu = line(tu, color = 'green', thickness = 0.05)
pltv = line(tv, color = 'blue', thickness = 0.05)
pltuv = line(uv, color = 'indigo', thickness = 0.05)
pltudot = line(tudot, color = 'violet', thickness = 0.05)
pltvdot = line(tvdot, color = 'red', thickness = 0.05)
pltdudv = line(dudv, color = 'orange', thickness = 0.05)
pltxudu = line(xudu, color = 'yellow', thickness = 0.5)
pltyvdv = line(yvdv, color = 'green', thickness = 0.5)

show(graphics_array([pltx,plty,pltxy,pltu,pltv,pltuv,pltudot,pltvdot,pltdudv],3,3), frame = True, axes = False, dpi = 200)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-02-08 03:17:43 +0200

ppurka gravatar image

updated 2013-02-08 04:14:45 +0200

It would have helped you (and others) if you had given a simpler example above and/or if you had posted the error you were getting. My explanation below is based on my own experimentation and it might not match what you are actually doing in your problem.

I suspect that your problems stem from the fact that result is a matrix (which is not mentioned in the question) and result[:,0] returns a vector due to which zip(ts, result[:,0]) returns a pair of values which looks like (float, (float)). Note that the second element is a vector and not just a floating point number. To overcome this problem you need to just get a list out of result[:,0] which is obtained by result[:,0].list(). Then the output of zip gives a tuple of floats. Below is an example with integers so that it is easier to see what is going on.

sage: result = random_matrix(ZZ, 2, 2)
sage: ts = random_vector(ZZ, 2)
sage: print "incorrect: ", zip(ts,result[:,0])
incorrect:  [(9, (1)), (1, (-1))]
sage: print "correct: ", zip(ts,result[:,0].list())
correct:  [(9, 1), (1, -1)]
edit flag offensive delete link more

Comments

okay I was able to get everything to show up correctly on the graphics_array. However for font size on the plots I was not able to change at all. code for one of the plots: pltx = list_plot(tx, color = 'red', plotjoined=True, thickness=0.5) I used list_plot instead of line like last time. I tried adding fontsize = 5 to the list_plot function it works only if I plot it separately. I even tried adding it to the show function for the graphics_array however the first plot in the array was the only one that was affected by the fontsize function.

eric.c.kangas gravatar imageeric.c.kangas ( 2013-02-08 13:09:28 +0200 )edit

Sounds like [#10657](http://trac.sagemath.org/10657).

ppurka gravatar imageppurka ( 2013-02-08 15:38:15 +0200 )edit

Sounds like this ticket should have been fixed ages ago. I guess I could then save each graph as an image and use libre office to setup the array.

eric.c.kangas gravatar imageeric.c.kangas ( 2013-02-09 11:30:04 +0200 )edit

We don't know what causes this issue. Hence, no fix yet :(

ppurka gravatar imageppurka ( 2013-02-09 19:56:40 +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

Stats

Asked: 2013-02-07 09:23:34 +0200

Seen: 415 times

Last updated: Feb 08 '13