skinny plots disappear when shown together

19 views
Skip to first unread message

Dan Drake

unread,
Nov 15, 2011, 10:25:49 PM11/15/11
to sage-...@googlegroups.com
Here are two skinny plots:

sage: foo = list_plot([(0, 0), (-4.85722573273506e-17, 0.251310273150262), (4.85722573273506e-17, 0.502620546300524), (-3.46944695195361e-17, 0.753930819450786), (6.93889390390723e-18, 1.00524109260105), (-2.08166817117217e-17, 1.25655136575131), (6.93889390390723e-18, 1.50786163890157), (2.08166817117217e-17, 1.75917191205183), (6.93889390390723e-18, 2.01048218520210), (-6.93889390390723e-18, 2.26179245835236), (-6.93889390390723e-18, 2.51310273150262), (-6.93889390390723e-18, 2.76441300465288)])

sage: t = var('t')
sage: bar = parametric_plot(((I*t).real(), (I*t).imag()), (t,0,pi), color='red', thickness=1.5)

Both display fine by themselves, but if I do

sage: foo + bar

I get an empty plot. But if I do

sage: bar + foo

I see what I would expect. This is very strange. I didn't expect the sum
of plots to be noncommutative! Is this a bug? Is there a workaround, for
those cases where I can't fiddle with the order?

Dan

--
--- Dan Drake
----- http://mathsci.kaist.ac.kr/~drake
-------

signature.asc

Jason Grout

unread,
Nov 15, 2011, 10:44:37 PM11/15/11
to sage-...@googlegroups.com

Yes. The problem is the aspect ratio is incorrectly updated. #11963
fixes this (needs review! :). However, in your case, #11963 makes both
of them be an empty plot, since bar has an aspect ratio of 1 and foo has
an aspect ratio of 'automatic', and a specific numeric aspect ratio wins
over 'automatic'.

The workaround is to explicitly set the aspect ratio to be 'automatic':

g=foo+bar
g.show(aspect_ratio='automatic')

(Note that doing g.set_aspect_ratio('automatic') is also fixed by #11963).

Right now the rule is that the aspect ratio of foo+bar is the maximum of
the aspect ratios of foo and bar, with any numeric aspect ratio taking
precedence over any 'automatic' aspect ratio. List plots are
'automatic' aspect ratios because they are often the sort of data you'd
find in plot. Parametric plots default to aspect ratio 1, since often
in a parametric plot you want angles and circles to look right, etc.
Should those rules be changed?

Thanks,

Jason

Reply all
Reply to author
Forward
0 new messages