Graphics Array and latex legends

105 views
Skip to first unread message

ObsessiveMathsFreak

unread,
Apr 8, 2011, 12:54:37 PM4/8/11
to sage-support
I'm encountering a problem with graphics_array and latex use in plots.
The following command works fine

p1=plot(x^2, (x, -pi, pi), color='blue')
G=graphics_array(((p1,p1),(p1,p1)))
G.show(figsize=[8,8])

But if latex code is added to the plot legend it produced and error

p1=plot(x^2, (x, -pi, pi), color='blue',legend_label="$\frac{\partial
f}{\partial x}$")
G=graphics_array(((p1,p1),(p1,p1)))
G.show(figsize=[8,8])

Traceback (click to the left of this block for traceback)
...
KeyError: 'pop(): dictionary is empty'

What exactly is the problem here and is there a workaround? Is there
any alternative way to give plots individual titles in a
graphics_array?

ObsessiveMathsFreak

unread,
Apr 8, 2011, 1:04:47 PM4/8/11
to sage-support
Actually, to correct myself, it appears that the problem is not latex
in the legend label, but the mere presence of a legend label at all.

The following still produces an "pop" error

p1=plot(x^2, (x, -pi, pi), color='blue',legend_label="f")
G=graphics_array(((p1,p1),(p1,p1)))
G.show(figsize=[8,8])

Traceback (click to the left of this block for traceback)
...
KeyError: 'pop(): dictionary is empty'


On Apr 8, 5:54 pm, ObsessiveMathsFreak <obsessivemathsfr...@gmail.com>
wrote:

kcrisman

unread,
Apr 8, 2011, 3:16:18 PM4/8/11
to sage-support


On Apr 8, 1:04 pm, ObsessiveMathsFreak <obsessivemathsfr...@gmail.com>
wrote:
> Actually, to correct myself, it appears that the problem is not latex
> in the legend label, but the mere presence of a legend label at all.
>
> The following still produces an "pop" error
>
> p1=plot(x^2, (x, -pi, pi), color='blue',legend_label="f")
> G=graphics_array(((p1,p1),(p1,p1)))
> G.show(figsize=[8,8])
>
>

Pop legend. There has to be a joke in here somewhere...

Anyway, this must be related to http://trac.sagemath.org/sage_trac/ticket/10244.
We just didn't do the same thing to GraphicsArray. This is now
http://trac.sagemath.org/sage_trac/ticket/11160

Thanks for the report!

- kcrisman

achrzesz

unread,
Apr 8, 2011, 5:10:00 PM4/8/11
to sage-support
This works for me:
p1=plot(x^2, (x, -pi, pi),label="f")
G=graphics_array(((p1,p1),(p1,p1)))
G.show(figsize=[8,8])

On 8 Kwi, 18:54, ObsessiveMathsFreak <obsessivemathsfr...@gmail.com>
wrote:

kcrisman

unread,
Apr 11, 2011, 10:54:55 PM4/11/11
to sage-support


On Apr 8, 5:10 pm, achrzesz <achrz...@wp.pl> wrote:
> This works for me:
> p1=plot(x^2, (x, -pi, pi),label="f")
> G=graphics_array(((p1,p1),(p1,p1)))
> G.show(figsize=[8,8])
>

Of course, that's not quite the same thing as a legend. Looks decent,
though.

- kcrisman
Reply all
Reply to author
Forward
0 new messages