Skip to content

Doc: Sort named colors example by palette #12209

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ImportanceOfBeingErnest
Copy link
Member

@ImportanceOfBeingErnest ImportanceOfBeingErnest commented Sep 22, 2018

PR Summary

Two recent ideas (#11927 and #12009) of adding more named colors to matplotlib were decided not be pursued further. In the course of this, however, it was proposed by @timhoffm to sort the named colors example, which is kind of the lookup table for colornames, by category names.

Despite the fact that we now still have only 4 different categories, such segregated visualization still makes sense.

This PR changes the example to produce 3 individual figures (XKCD colors are left out, as that would produce a huge figure), one for the BASE_COLORS, the Tableau colors and the CSS colors, respectively.

Previously:

the named colors example

image

With this PR:

ci-built example (updated with feedback from below)

image

PR Checklist

  • Code is Flake 8 compliant
  • Documentation is sphinx and numpydoc compliant

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

The description should be updated. This is not a " Simple plot example" anymore.

=======================
Listing of named colors
=======================
 
This is a list of the named colors supported in matplotlib. Note that
xkcd colors are supported as well, but are not listed here for brevity.
 
For more information on colors in matplotlib see

Maybe link [xkcd colors].

Bonus points, if you give the titles a bit more vertical space. They are quite squeezed to the colors (c.f. the example in my comment).

return fig

plot_colortable(mcolors.BASE_COLORS, "Base Colors",
sort_colors=False, emptycols=2)
Copy link
Member

Choose a reason for hiding this comment

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

Use emptycols=1. That way the columns will be bgr, cmy and kw, which is sort of a natural grouping.

@ImportanceOfBeingErnest
Copy link
Member Author

All good comments. Updated.

Copy link
Member

@timhoffm timhoffm left a comment

Choose a reason for hiding this comment

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

I would also change the title to "Listing of named colors" or "Overview of named colors". That's more to the purpose of the page. "Visualizing" puts too much emphasis on the drawing aspect. The example is basically there to look at the result, not to be able to do this yourself.

@ImportanceOfBeingErnest
Copy link
Member Author

Sorry, I totally missed the point about the title. "Visualizing named colors" isn't exactly wrong. I find it actually better than "listing named colors" (which is how I must have read the title).
The main point being the use of the gerund, which puts focus on the action of listing or visualizing.
So instead, "List(ing) of named colors" or "Named colors visual" is indeed better, as it's the resulting image that's in the focus really. Given that this has been merged already, I'm not sure if it's worth doing a new PR (but I wouldn't object anyone doing it either).

Let me just add that not changing the title of examples between different versions has some advantage as well, as it allows to quickly find the same content for different versions of the docs.

tacaswell added a commit that referenced this pull request Sep 24, 2018
…209-on-v3.0.0-doc

Backport PR #12209 on branch v3.0.0-doc (Doc: Sort named colors example by palette)
tacaswell added a commit that referenced this pull request Sep 24, 2018
…209-on-v3.0.x

Backport PR #12209 on branch v3.0.x (Doc: Sort named colors example by palette)
@ImportanceOfBeingErnest ImportanceOfBeingErnest deleted the doc-classify_named_colors branch February 17, 2019 23:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants