Opened 7 years ago

Closed 7 years ago

#12936 closed enhancement (fixed)

Adding plots should (at least attempt to) preserve legend options

Reported by: mjo Owned by: jason, was
Priority: major Milestone: sage-5.1
Component: graphics Keywords:
Cc: Merged in: sage-5.1.beta1
Authors: Michael Orlitzky Reviewers: Andrey Novoseltsev
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by mjo)

The __add__() method of plots doesn't make any attempt to preserve legend options. This will show the default legend:

sage: p1 = plot(x, x, 0, 1, legend_label='foo')             
sage: p1.set_legend_options(back_color='white', shadow=True)
sage: p2 = p1 + p1                                          
sage: p2._Graphics__legend_opts                             
{}

We do preserve some other information, so it should be easy to add this.

Attachments (1)

sage-trac_12936.patch (2.4 KB) - added by mjo 7 years ago.
Merge plot options the same way we do other keyword arguments.

Download all attachments as: .zip

Change History (7)

comment:1 Changed 7 years ago by mjo

  • Authors set to Michael Orlitzky
  • Status changed from new to needs_review

comment:2 follow-up: Changed 7 years ago by novoselt

  • Reviewers set to Andrey Novoseltsev
  • Status changed from needs_review to needs_work

This is a nice improvement, but the patch does not apply for me on Sage-5.0.rc0. Either it has to be rebased, or there are some dependencies.

comment:3 in reply to: ↑ 2 Changed 7 years ago by mjo

  • Description modified (diff)

Replying to novoselt:

This is a nice improvement, but the patch does not apply for me on Sage-5.0.rc0. Either it has to be rebased, or there are some dependencies.

Not only that, but I forgot to set any options in the description =)

I just built rc1 and will fix it.

Changed 7 years ago by mjo

Merge plot options the same way we do other keyword arguments.

comment:4 Changed 7 years ago by mjo

  • Status changed from needs_work to needs_review

Should be fixed now. It looks like that method was just moved to graphics.py.

comment:5 Changed 7 years ago by novoselt

  • Status changed from needs_review to positive_review

comment:6 Changed 7 years ago by jdemeyer

  • Merged in set to sage-5.1.beta1
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.