Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graphics Array needs suboptions to show #11160

Closed
kcrisman opened this issue Apr 8, 2011 · 14 comments
Closed

Graphics Array needs suboptions to show #11160

kcrisman opened this issue Apr 8, 2011 · 14 comments

Comments

@kcrisman
Copy link
Member

kcrisman commented Apr 8, 2011

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' 

This is reported at this sage-support thread.

I think the fix should be the same as at #10244, but for the GraphicsArray class.

Related tickets:

CC: @jasongrout @johanrosenkilde @sagetrac-jhonrubia6 @fchapoton

Component: graphics

Issue created by migration from https://trac.sagemath.org/ticket/11160

@kcrisman
Copy link
Member Author

kcrisman commented Apr 8, 2011

comment:1

Hmm, but that doesn't work... but it must be a similar issue, anyway.

@kcrisman
Copy link
Member Author

kcrisman commented Apr 8, 2011

comment:2

Adding the suboptions we usually send to save to the normal !Graphics class matplotlib removes the error, but does the following - see attached graphic. I don't have time to do any more with this now, though.

@kcrisman
Copy link
Member Author

kcrisman commented Apr 8, 2011

Note the second graph has two legends for the same function!

@kcrisman
Copy link
Member Author

kcrisman commented Apr 8, 2011

comment:3

Attachment: tmp_0.png

Replying to @kcrisman:

Adding the suboptions we usually send to save to the normal !Graphics class matplotlib removes the error, but does the following - see attached graphic. I don't have time to do any more with this now, though.

I should add that my code was slightly simpler:

sage: p = plot(x,legend_label='f')
sage: G = graphics_array((p,p))
sage: G

@johanrosenkilde
Copy link
Contributor

comment:5

This is a bug which might be related:

sage: g = Graphics()
sage: g += plot(x,legend_label='f')
sage: g.set_legend_options(title="Nice")
sage: G = graphics_array((g,g))
sage: G.show()
...
KeyError: 'font_family'

It seems that this part of the problem might be completely solved by adding the suboptions usually added when show()'ing a graphics object.

@kcrisman

This comment has been minimized.

@egourgoulhon
Copy link
Member

comment:8

The issue described here is fixed in #27865.

@egourgoulhon
Copy link
Member

comment:9

Since #27865 has been merged in Sage 8.9.beta0, we could close this ticket as duplicate.

@johanrosenkilde
Copy link
Contributor

comment:11

All the examples listed here work fine in the newest develop, at least.

@egourgoulhon
Copy link
Member

comment:12

Replying to @johanrosenkilde:

All the examples listed here work fine in the newest develop, at least.

Then maybe you could set this ticket to positive review, given its status is "sage-duplicate/invalid/wontfix" (the positive review is necessary to close it).

@kcrisman
Copy link
Member Author

comment:13

Any doctests necessary or are they all included in #27865 as I suspect?

@egourgoulhon
Copy link
Member

comment:14

Replying to @kcrisman:

Any doctests necessary or are they all included in #27865 as I suspect?

Yes the doctests relevant to this ticket are included in #27865; in Sage 8.9.beta6, you can find them in lines 3481 - 3499 of src/sage/plot/plot.py:

        sage: L = [plot(sin(k*x), (x,-pi,pi)) for k in [1..3]]
        sage: ga = graphics_array(L)
        sage: ga.show(figsize=[5,3])  # smallish and compact

        sage: ga.show(figsize=[5,7])  # tall and thin; long time

        sage: ga.show(figsize=4)  # width=4 inches, height fixed from default aspect ratio

as well as in lines 555-613 of src/sage/plot/multigraphics.py:

        sage: g1 = plot(sin(x^2), (x, 0, 6), axes_labels=['$x$', '$y$'],
        ....:           axes=False, frame=True, gridlines='minor')
        sage: y = var('y')
        sage: g2 = streamline_plot((sin(x), cos(y)), (x,-3,3), (y,-3,3),
        ....:                      aspect_ratio=1)
        sage: g3 = graphs.DodecahedralGraph().plot()
        sage: g4 = polar_plot(sin(5*x)^2, (x, 0, 2*pi), color='green',
        ....:                 fontsize=8) \
        ....:      + circle((0,0), 0.5, rgbcolor='red', fill=True, alpha=0.1,
        ....:               legend_label='pink')
        sage: g4.set_legend_options(loc='upper right')

        sage: G = graphics_array([g1, g2, g3, g4])

        sage: G.show(figsize=[8, 3])

@kcrisman
Copy link
Member Author

comment:15

I only asked because maybe that is why someone hasn't hit positive review. So I guess jsrn should :-) or actually you could as well, I think.

@egourgoulhon
Copy link
Member

comment:16

Similarly #10466 and #10657 are set to "duplicate" and are waiting for a positive review to be closed...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants