Opened 15 years ago
Closed 13 years ago
#1509 closed enhancement (fixed)
[with patch, positive review] Allow text rotation in plotting
Reported by: | was | Owned by: | was |
---|---|---|---|
Priority: | major | Milestone: | sage-4.2 |
Component: | graphics | Keywords: | |
Cc: | Merged in: | sage-4.2.alpha0 | |
Authors: | Matthew Trumbell | Reviewers: | Karl-Dieter Crisman |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
Since axes_label is broken in plot(), one must resort to adding your own custom labels to a plot(). It would be nice in this application, and others, if one could rotate text objects. For example, it would be nice to be able to make a custom y-axis label that was parallel to the y-axis. I guess, in general, the ability to rotate text would be a useful feature.
For Sage, make sure to look up how Mathematica does text rotation, etc., and use that interface instead of making something up at random.
Attachments (3)
Change History (10)
comment:1 follow-up: 2 Changed 13 years ago by
Changed 13 years ago by
Attachment: | text.py.patch added |
---|
comment:2 follow-up: 3 Changed 13 years ago by
Replying to mrtrumbe:
Regarding text rotation, can we just pass through the rotation option? This option is already available on the underlying matplotlib text objects, so it seems like a layup. I've attached a patch which accomplishes just that (it is a very minor change). This seems to work quite well here.
I tried to download it and got a strange method. I guess it is not an hg patch but a diff?
Also, did you include an example in the docstring to illustrate your new feature?
comment:3 follow-up: 4 Changed 13 years ago by
Replying to wdj:
I tried to download it and got a strange method. I guess it is not an hg patch but a diff?
Also, did you include an example in the docstring to illustrate your new feature?
Sorry, I'm new to sage dev practices...is there documentation on generating a standard patch? I used diff to generate the attached patch.
I didn't include an example usage in the docstrings, but did include explanation of the feature. I'll update the docstring accordingly and update the patch.
comment:4 Changed 13 years ago by
Replying to mrtrumbe:
Replying to wdj:
I tried to download it and got a strange method. I guess it is not an hg patch but a diff?
Also, did you include an example in the docstring to illustrate your new feature?
Sorry, I'm new to sage dev practices...is there documentation on generating a standard patch? I used diff to generate the attached patch.
http://www.sagemath.org/doc/developer/conventions.html and http://www.sagemath.org/doc/developer/producing_patches.html
I didn't include an example usage in the docstrings, but did include explanation of the feature. I'll update the docstring accordingly and update the patch.
Thanks.
Changed 13 years ago by
Attachment: | 12846.2.patch added |
---|
Patch was premature. Accidental revert of other changes. Will fix shortly.
Changed 13 years ago by
Attachment: | 12846.patch added |
---|
This is a proper hg patch. Code is docstring tested.
comment:6 Changed 13 years ago by
Authors: | → Matthew Trumbell |
---|---|
Reviewers: | → Karl-Dieter Crisman |
Summary: | plotting -- improve text support → [with patch, positive review] Allow text rotation in plotting |
This is really neat, as the graphic says! It makes good sense to get more of the mpl functionality exposed, even if axes_labels now works again. Positive review. Apply only most recent patch.
comment:7 Changed 13 years ago by
Merged in: | → sage-4.2.alpha0 |
---|---|
Resolution: | → fixed |
Status: | positive_review → closed |
Regarding text rotation, can we just pass through the rotation option? This option is already available on the underlying matplotlib text objects, so it seems like a layup. I've attached a patch which accomplishes just that (it is a very minor change). This seems to work quite well here.
As for how Mathematica accomplishes it, take a look at their page: http://demonstrations.wolfram.com/HowTextRotationWorksInMathematica/
I think a solution like that would be pretty easy in sage. For example, this might work: a function which takes a text graphics primative and an angle and properly applies the rotation to the underlying matplotlib text object.