| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
|
This looks great! Thanks for the addition to the gallery. |
Sorry, something went wrong.
| ax.spines['top'].set_color('none') | ||
| ax.xaxis.set_ticks_position('bottom') | ||
| ax.tick_params(which='major', width=1.00, length=5) | ||
| ax.tick_params(which='minor', width=0.75, length=2.5, labelsize=10) |
There was a problem hiding this comment.
This is a bit confusing, not being the default, but maybe it should be?
Sorry, something went wrong.
There was a problem hiding this comment.
I'm not sure I understand what you mean
Sorry, something went wrong.
There was a problem hiding this comment.
I mean it might be confusing for users to see the documentation use this look, with different tick lengths/fontsizes for major/minor, when it's not really how it would look by default.
Sorry, something went wrong.
There was a problem hiding this comment.
Ok, now I get your point. The idea was to emphasize the fact that you can control major / minor ticks / labels separately and the different font sizes really suggest this (at least to me).
Since this is a submission to the gallery, is it important to enforce the defaults ?
Sorry, something went wrong.
There was a problem hiding this comment.
The whole goal of this example is to show what you can do with axes and ticks. That means changing the default. I don't see how you could do something identical with the defaults. I also don't see how this could confuse the user: the example is well written and clear.
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry, was confusing this with the other PR and where it was going.
Also, I thought it looked nice enough to be a default, but I think the time for changing that has passed.
Sorry, something went wrong.
|
Is there a way in the examples to more clearly show how multiple locator differes from maxN differed from auto? Like maybe change to a 1-10 range to have more wiggle room? Or use different scales-dunno, but I figure this image is at its most useful if readers don't necessarily have to read the code to get what it's trying to show. |
Sorry, something went wrong.
|
@story645 You're right. Maybe 5 was not the best value to illustrate the different strategies. I'll try to play a bit more with the MaxN. |
Sorry, something went wrong.
|
Yay! Now maybe something with multiples of 2 for multiple locator? And possibly using the axis text to explain what the formatters are labeling as that might explain strformatter vs scaler formatter. Formatstrformatter and strmethod formatter seem to work exactly the same/do the same thing...so I'm confused there. |
Sorry, something went wrong.
|
FormatStrFormatter expects the old-style '%' based strings, StrMethodFormatter takes the new-style '{}' based format strings. |
Sorry, something went wrong.
|
Ugh...since python documentations says both of those are format strings, wouldn't it have made more sense to fold the functionality for both into one of those functions? For the same of this example though, then maybe add the format string to the label FormatStrFormatter('>%d<')? @rougier IndexLocator seems to be MultipleLocator where the start value for the ticks isn't necessarily 0. So given plot(range(2, 20)) Multiplelocator with base=5 will yield 5, 10, 15, 20 whereas indexLocator can be given base=5 and offset=2 and therefore yield 2, 7, 12, 17. This is probably most useful for year plots where you want every 5 or 10. This might also work with just base=5, as the main point is IndexLocator locates every 5th point (hence index) whereas MultipleLocator locates multiples of 5. |
Sorry, something went wrong.
|
@story645 And you need some data (i.e. some plot) to make it work, right ? |
Sorry, something went wrong.
|
Not exactly, I think that's where using the offset argument may come in. |
Sorry, something went wrong.
|
@story645 Coudl make a PR on my PR to show the IndexLocator case ? |
Sorry, something went wrong.
Sorry, something went wrong.
|
Thanks, I've updated the PR and the screenshot at the top. |
Sorry, something went wrong.
|
I still think you should change some of the other examples-like change multiple locator to be multiples of 5 or something so it's really clear what it does. And possibly put the parameters in the text for each of the locators/formatters. |
Sorry, something went wrong.
|
Done. |
Sorry, something went wrong.
|
Awesome! Can you also please add the name of the args for LinearLocator and LogLocator? Also, can you put the format strings you used for FormatStr formatter and for StrMethod formatter in parenthesis next to each, so FormatStr formatter(">%d<") and the like? |
Sorry, something went wrong.
|
Yay! A few slight nitpicks (I'm almost sorry for this, but...):
|
Sorry, something went wrong.
|
No problem but at this point I think it's a matter of personal test:
|
Sorry, something went wrong.
|
Sorry, something went wrong.
Done. Didn't update screenshots at top. |
Sorry, something went wrong.
|
Yay! Mind updating the picture? |
Sorry, something went wrong.
Sorry, something went wrong.
|
I don't understand why FixedFormatter starts with a blank string, but the first tick still has a 0 on it? |
Sorry, something went wrong.
There was a problem hiding this comment.
Should we use plt.subplots instead of individual plt.subplot?
Sorry, something went wrong.
|
|
||
|
|
||
| plt.tight_layout() | ||
| # plt.savefig("tick-formatters.pdf") |
There was a problem hiding this comment.
We won't need these.
Sorry, something went wrong.
| fontsize=15, transform=ax.transAxes) | ||
|
|
||
| plt.tight_layout() | ||
| # plt.savefig("tick-locators.pdf") |
There was a problem hiding this comment.
Won't need these.
Sorry, something went wrong.
|
+1 on @QuLogic's suggestion of using plt.subplots 'cause then you can just loop over the setup ax stuff trivially and that leaves the examples a lot cleaner and it becomes much more trivial to reorder them ;) |
Sorry, something went wrong.
|
I think it's preferable to have subplot because it makes each sub-example self-contained. You can just copy and paste into your code and for me it's what example are useful for. The main point here are tick locators / formatters, it is not about subplot/subplots. As for the empty string in FixedFormatter, I think this is a bug but I forgot to report. |
Sorry, something went wrong.
|
I opened issue #7122 about the FixedFormatter problem. In the meantime, it seems there's also a bug in MultipleLocator (same issue). PR #7123 has been proposed to fix the bug. |
Sorry, something went wrong.
| ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00)) | ||
| ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25)) | ||
| ax.xaxis.set_major_formatter(ticker.FuncFormatter(major_formatter)) | ||
| ax.text(0.0, 0.5, "FuncFormatter(myfunc)", fontsize=15, transform=ax.transAxes) |
There was a problem hiding this comment.
FuncFormatter(lambda x, pos: "[%.2f]" % x) seems a better caption? Also, the minor_formatter function seems unused?
Sorry, something went wrong.
There was a problem hiding this comment.
Good points.
Sorry, something went wrong.
Sorry, something went wrong.
|
Merge this as-is, clean up the fall-out later if needed. |
Sorry, something went wrong.
DOC: Tick locators & formatters examples
| Back | FazBrowse Home | New Git URL |
This is an example showing the different tick locators (but the IndexLocator since I don't understantd how it works) and tick formatters.