Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix lost ticks#1686

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
efiring merged 12 commits intomatplotlib:masterfromdhyams:fix_lost_ticks
Feb 19, 2013
Merged

Fix lost ticks#1686

efiring merged 12 commits intomatplotlib:masterfromdhyams:fix_lost_ticks
Feb 19, 2013

Conversation

dhyams
Copy link
Contributor

For issue#1310: Drops last tick label for some ranges

Added a strategy to stop losing ticks on the ends of an axis. The approach that is
used is to pad the interval that is being used to "clip" ticks from the axis because
they are off the end.

The padding is chosen specifically such that the tick cannot be drawn a pixel past the
end of the axis. So long as the tick is within this bound, it should be OK to draw it.

Daniel Hyams added3 commitsJanuary 19, 2013 19:08
…roach that isused is to pad the interval that is being used to "clip" ticks from the axis becausethey are off the end.The padding is chosen specifically such that the tick cannot be drawn a pixel past theend of the axis.  So long as the tick is within this bound, it should be OK to draw it.
… willgive locations one past what they really need to.  This is necessary, becausein situations where round off error matters, we want the locator to offermore that it really thinks it needs to.  The clipping of ticks still takesplace in the Axis class, so it's perfectly fine to add more locs than necessary.In fact, matplotlib relies on the clipping behavior in the Axis class alreadyto not draw ticks outside of the limits of the axis.
@WeatherGod
Copy link
Member

Interesting idea. I will have to take a closer look at its implications in
mplot3d.

@dhyams
Copy link
ContributorAuthor

I just saw that there are five fails in the Travis build. Two of these are by design...the MultipleLocator and LogLocator now return one more location on each end of the axis than they used to.

The other three are image fails, and I don't know how to access the before/after images.

@mdboom
Copy link
Member

Unfortunately, with Travis there isn't a way to access the images -- you just have to run the tests again locally when something fails.

The other failure seems to be that the theta ticking on a polar plot is somehow broken. The one with the missing theta labels is from this branch -- the other is from the baseline images.

polar_rmin
polar_rmin-expected

@dhyams
Copy link
ContributorAuthor

Thanks Michael: I've installed nose and other dependencies, and I'm running the tests now. Good thing for the nose, or the polar thing would not have been caught ;)

…fixed a problemin the calculation of the log tick locations.
@efiring
Copy link
Member

On 2013/01/25 1:25 PM, dhyams wrote:

Oh, and I forgot to ask the question that I came here for...when I run a
nose test, is it testing the currently installed version of matplotlib
that it (or anyone) can get to (meaning whatever mpl I can import if I
type 'import matplotlib'), or the source code that is in the paths
underneath where tests.py is located?

It's running whatever is installed.


Reply to this email directly or view it on GitHub
#1686 (comment).

@dmcdougall
Copy link
Member

Leaving a note here for github linkage foo: this PR is an alternative to PR#1659.

Daniel Hyams added2 commitsJanuary 27, 2013 21:02
…n a distancein data coordinates, it should return 0.0 instead of 0 when appropriate.
@mdboom
Copy link
Member

Just a note -- the Travis failures seem to be identical to those onmaster -- so this is "passing" by some description, at least.

@dhyams
Copy link
ContributorAuthor

Right; they seem to be some weird difference in fonts; perhaps the reference images just need to be updated?

@dhyams
Copy link
ContributorAuthor

On this one, is there anything else that I need to do?

@@ -1165,7 +1165,7 @@ def tick_values(self, vmin, vmax):
vmin = self._base.ge(vmin)
base = self._base.get_base()
n = (vmax - vmin + 0.001 * base) // base
locs = vmin + np.arange(n +1) * base
locs = vmin-base + np.arange(n +3) * base
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

As per PEP8, there should be spaces either side of the minus operator.

@pelson
Copy link
Member

We're trying to standardize the codebase on PEP8, so would you mind going through and putting things like spaces between operators and after commas etc.

Cheers,

@dhyams
Copy link
ContributorAuthor

Sure, I'll modify it tonight and push again. I do wish, though, that there was a reasonable workflow such that others could make minor edits to changeset like this...in a fraction of the time required to post comments, it could have just been corrected to conform to pep8. Now I put it on my to-do list; pull up the vm when I get home, reread my git cheat sheet, make a couple of tiny edits, repush, verify that the changes made it, and await comment again. Seems like a very inefficient process, when it would be ideal just to make the edits right here in github. Just wondering if it were even possible. OK, enough of my whining ;) I don't mean it in a derogatory sense...just wondering if a more efficient process is available.

@mdboom
Copy link
Member

You can edit directly on github, on your own branch. Just go to your fork (github.com/dhyams/matplotlib), choose the branch related to this pull request, browse to the file, press the Edit button... it will let you edit the commit message, and the changes will automatically show up in this pull request.

As another time saver (which only works if you have the code checked out on your local machine), I usethis which adds a "open in editor" button toevery comment on github, which opens up the given file to the correct line in my editor. The example is with emacs, but there's nothing about the approach that couldn't be used with most other editors.

PEP8 fixes, and part of a comment changed to a docstring.Also added a try/except around each call to _get_pixel_distance_along_axis, so thatif something goes wrong with some off-beat transform, we just don't pad; thingsrevert back to old matplotlib behavior.
@dhyams
Copy link
ContributorAuthor

Thank you mdboom; I had no idea that you could edit and commit like that. Of course, doing so makes it blindingly obvious that the changes are not tested, right ;)

@@ -1599,6 +1618,30 @@ def _get_offset_text(self):
self.offset_text_position = 'bottom'
return offsetText

def _get_pixel_distance_along_axis(self,where,perturb):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Here and below, PEP8 spaces after commas, please.

@efiring
Copy link
Member

@WeatherGod, you commented a month ago that you needed to check for 3D implications. Any thoughts on that, or any other aspect of this? It would be good to either get this moving, or reject it.

Daniel Hyams added3 commitsFebruary 18, 2013 13:31
the _get_pixel_distance routines.  Also added a warning emit, so thatthe try/catch at least says something if it is triggered.
@WeatherGod
Copy link
Member

Doesn't seem to have any negative impacts for mplot3d, as far as I can see. Haven't really had the time to examine the change in-depth, but I think the basic idea is sound.

efiring added a commit that referenced this pull requestFeb 19, 2013
@efiringefiring merged commit1aa61e3 intomatplotlib:masterFeb 19, 2013
@efiring
Copy link
Member

Let's see how it works in practice.

efiring added a commit to efiring/matplotlib that referenced this pull requestApr 9, 2018
Inmatplotlib#1686 this was set to half a pixel, but I don't think this makessense, and it is not needed in order to pass the test that wasadded to check for lost ticks (matplotlib#1310), or for the cases inmatplotlib#1310.
efiring added a commit to efiring/matplotlib that referenced this pull requestSep 4, 2018
Inmatplotlib#1686 this was set to half a pixel, but I don't think this makessense, and it is not needed in order to pass the test that wasadded to check for lost ticks (matplotlib#1310), or for the cases inmatplotlib#1310.
@dstansbydstansby mentioned this pull requestSep 25, 2021
3 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v1.2.x
Development

Successfully merging this pull request may close these issues.

6 participants
@dhyams@WeatherGod@mdboom@efiring@dmcdougall@pelson

[8]ページ先頭

©2009-2025 Movatter.jp