Opened 8 years ago

Closed 3 weeks ago

#11160 closed defect (duplicate)

Graphics Array needs suboptions to show

Reported by: kcrisman Owned by: jason, was
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: graphics Keywords:
Cc: jason, jsrn, jhonrubia6, chapoton Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by kcrisman)

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:

  • #10656 - Graphics Arrays should be able to become Graphics objects
  • #10657 - options should be passed to all graphics, and they should be set separately if desired

Attachments (1)

tmp_0.png (16.0 KB) - added by kcrisman 8 years ago.
Note the second graph has two legends for the same function!

Download all attachments as: .zip

Change History (18)

comment:1 Changed 8 years ago by kcrisman

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

comment:2 follow-up: Changed 8 years ago by 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.

Changed 8 years ago by kcrisman

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

comment:3 in reply to: ↑ 2 Changed 8 years ago by kcrisman

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

comment:4 Changed 8 years ago by jason

  • Cc jason added

comment:5 Changed 8 years ago by jsrn

  • Cc jsrn added

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.

comment:6 Changed 8 years ago by kcrisman

  • Description modified (diff)

comment:7 Changed 3 years ago by jhonrubia6

  • Cc jhonrubia6 added

comment:8 Changed 4 months ago by egourgoulhon

The issue described here is fixed in #27865.

comment:9 Changed 2 months ago by egourgoulhon

  • Cc fchapoton added
  • Milestone set to sage-duplicate/invalid/wontfix
  • Status changed from new to needs_review

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

comment:10 Changed 2 months ago by egourgoulhon

  • Cc chapoton added; fchapoton removed

comment:11 follow-up: Changed 2 months ago by jsrn

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

comment:12 in reply to: ↑ 11 Changed 2 months ago by egourgoulhon

Replying to jsrn:

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).

comment:13 follow-up: Changed 5 weeks ago by kcrisman

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

comment:14 in reply to: ↑ 13 Changed 5 weeks ago by egourgoulhon

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])

comment:15 Changed 5 weeks ago by kcrisman

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.

comment:16 Changed 4 weeks ago by egourgoulhon

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

comment:17 Changed 3 weeks ago by chapoton

  • Resolution set to duplicate
  • Status changed from needs_review to closed
Note: See TracTickets for help on using tickets.