Opened 9 years ago

Closed 7 years ago

Last modified 7 years ago

#10512 closed enhancement (fixed)

wrap matplotlib's title functionality

Reported by: jason Owned by: jason
Priority: major Milestone: sage-5.3
Component: graphics Keywords:
Cc: kcrisman, slabbe Merged in: sage-5.3.beta2
Authors: Jason Grout, Punarbasu Purkayastha, Sébastien Labbé Reviewers: Sébastien Labbé, Punarbasu Purkayastha
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Attachments (3)

trac-10512-plot-title.patch (3.9 KB) - added by jason 9 years ago.
trac-10512-plot-title.1.patch (4.7 KB) - added by ppurka 7 years ago.
updated to sage-5.2, fixed position
trac_10512_review-sl.patch (2.0 KB) - added by slabbe 7 years ago.
Applies over the preceding patche

Download all attachments as: .zip

Change History (16)

comment:1 Changed 9 years ago by kcrisman

  • Cc kcrisman added

Changed 9 years ago by jason

comment:2 follow-ups: Changed 9 years ago by jason

  • Owner changed from jason, was to jason

I've attached a patch. There is still an issue that needs to be solved, though. In this plot:

plot(sin(x^2), (x, -3, 3), title='Plot of sin(x)', axes_labels=['x','y'],frame=True)

the title overwrites the axis label. Maybe the axis label should be smarter here, or the plot title should be slightly adjusted up in this situation.

comment:3 Changed 9 years ago by jason

  • Cc slabbe added
  • Status changed from new to needs_work

comment:4 in reply to: ↑ 2 Changed 9 years ago by slabbe

plot(sin(x^2), (x, -3, 3), title='Plot of sin(x)', axes_labels=['x','y'],frame=True)

I get no problem when frame=True but do get the described problem when frame=False.

Sébastien

comment:5 Changed 7 years ago by ppurka

  • Authors set to Jason Grout
  • Description modified (diff)
  • Status changed from needs_work to needs_review

Updated the patch to sage-5.2 and fixed the positioning of the title. Please review.

Changed 7 years ago by ppurka

updated to sage-5.2, fixed position

comment:6 Changed 7 years ago by ppurka

There was a small typo in the backticks used around the title docstring. Fixed it now.

Changed 7 years ago by slabbe

Applies over the preceding patche

comment:7 Changed 7 years ago by slabbe

I added a patch which adds a doctest about the fact that

plot(sin(x^2), (x, -3, 3), title='Plot of sin(x^2)', axes_labels=['x','y'],frame=True)

should be ok (no overlap between title and axes labels). I know the doctest system won't see in the future if it is not the case, but at least the documentation will recall it.

Also added some x^2 in title instead of x.

My patch needs review.

I tested ppurka patch. All tests passed on sage/combinat/graphics.py and plot.py. Documentation builds fine. I give a positive review to his patch.

BTW I am wondering why ppurka started from scratch instead of applying a patch over jason's one? Jason work will not appear in the log...

comment:8 Changed 7 years ago by slabbe

  • Description modified (diff)

comment:9 Changed 7 years ago by ppurka

Hello, the patch still contains Jason's name in the patch header. The patch fails in many places in 5.2, and I had to move many of the patch lines from plot.py to graphics.py. Otherwise the code is almost the same as what Jason had.

comment:10 Changed 7 years ago by ppurka

  • Authors changed from Jason Grout to Jason Grout, Punarbasu Purkayastha, Sebastien Labbe
  • Reviewers set to Sebastien Labbe, Punarbasu Purkayastha
  • Status changed from needs_review to positive_review

Thanks for the patch. That was a good catch on the typos. :) Positive review from me.

I see now what you actually meant in comment:7. I am setting the authors as all three of us. That should be good enough.

comment:11 Changed 7 years ago by jdemeyer

  • Merged in set to sage-5.3.beta2
  • Resolution set to fixed
  • Status changed from positive_review to closed

comment:12 Changed 7 years ago by jdemeyer

  • Authors changed from Jason Grout, Punarbasu Purkayastha, Sebastien Labbe to Jason Grout, Punarbasu Purkayastha, Sébastien Labbé
  • Reviewers changed from Sebastien Labbe, Punarbasu Purkayastha to Sébastien Labbé, Punarbasu Purkayastha

comment:13 in reply to: ↑ 2 Changed 7 years ago by kcrisman

Replying to jason:

I've attached a patch. There is still an issue that needs to be solved, though. In this plot:

plot(sin(x^2), (x, -3, 3), title='Plot of sin(x)', axes_labels=['x','y'],frame=True)

the title overwrites the axis label. Maybe the axis label should be smarter here, or the plot title should be slightly adjusted up in this situation.

It turns out that this happens in matrix plots as well, even with this code (because it has a frame). See this ask.sagemath.org question. I've opened #13625 for this.

Note: See TracTickets for help on using tickets.