-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Miscellaneous style fixes #1518
Conversation
@jbednar @philippjfr Following on from our earlier discussion, I've come to a decision as to what I think we should do about colormaps: I would bundle a bunch of popular/useful colormaps in My reasoning is as follows:
What do you think? I imagine a structure like this:
I think |
Why not just require colorcet then? Seems like the better solution.
Not sure what that means to be honest, colormaps are generally just stored as a list of colors and all plotting backends I know of support this format.
Again, why convert to some other format? Matplotlib accepts matplotlib colormaps obviously, and bokeh and plotly both accepts lists of colors which a matplotlib colormap can easily be converted to on the fly. I think my preference is to require colorcet and consistently support the three new matplotlib colormaps which are also included in bokeh (viridis, magma and inferno). |
Fine by me. Included in core or in the plotting backends?
Hex color strings, RGB tuples, RGBA tuples, Nx3 numpy array? There are lots of ways to list colors. If all the plotting backends you know all accept all of the possible formats, then I take your point though I suspect there are some ways of specifying colormaps accepted by some libraries but not others. Anyway, the plan doesn't hinge on this particular comment.
Easily yes so why not put that in core in the same place where we ship the bundled colormaps?
I'm not sure that is enough though requiring colorcet does seem fine to me. We want to remove the matplotlib dependency bokeh has wrt colormaps and we used to support any matplotlib colormap with bokeh. We should have some sort of warning if a matplotlib colormap is referenced without matplotlib installed. |
Probably the plotting backends I suppose, no strong opinion though.
As far as I'm aware the first three are supported by both matplotlib and bokeh, Nx3 arrays don't seem like a sensible format to list colors as in a file.
Sure, color conversion utilities should live in the main holoviews repo.
Sure, I'd be open to make a shortlist of matplotlib colormaps to include somewhere, not sure where to draw the line though.
Definitely, it should warn and fall back to something else gracefully I suppose. |
I think we are mostly agreed now and just need to decide which matplotlib ones to include.
I'm not sure we can sensible fallback. We can at least generate a descriptive exception that explains why the colormap is not available (as opposed to just a matplotlib import error). |
Right, I'm not sure there's any we need in particular. The categorical ones (Set1-3 and other brewer palettes) are the ones I can think of atm but those are also included in bokeh in some form so maybe we can just make those behave the same by some other means.
I don't think a styling error should ever cause a hard exception if possible, styling is secondary to the data and as long as it warns sensibly you should get a plot regardless. |
Sure. As long as you fallback to a very different colormap. If you fall back from |
I don't think the fallbacks should be intelligent in any way, it should simply fall back to a default colormap that we have defined and know exists. If a user assumes they got the correct colormap despite a warning stating the opposite that's their fault really. |
If 'fire' becomes our default colormap then that would be it. That policy should mostly be ok though I guess that depends on how many similar looking colormaps (e.g 'hot') are not common between our plotting backends. As long as most of the common colormaps that look similar to 'fire' are always supported then there is less potential for confusion (even with a warning). To summarize what we have decided:
If that is true and you are sure we really don't need to include any other matplotlib colormaps, then we don't really need a |
@philippjfr Added |
Just to make the link to the issue: this PR is helping address #823 . |
The background color change is expected by PR #1537 - we want to remove this cell: # HIDDEN CELL!
%output backend='matplotlib'
# New style should follow this by default
%opts Spikes [bgcolor='white']
%opts Curve [bgcolor='white'] |
Finally set the default colormap to 'fire'! Also, issue #1006 might help inform any other style changes we want to make (e.g disable |
@jbednar @philippjfr Getting this PR merged ASAP is now top priority. No point having gifs with outdated styles of gifs with new styles that users don't see! Plan:
I'll start trying to get the tests green on travis in this PR so we can merge these style fixes. |
Looks like I might have gotten travis working the way I want after on the first go editing travis.yaml! There is a first time for everything. :-) I'll try the suggested
Not sure about trying to match sizes between backends but should we try to set the errorbar line width and disabling grid lines? |
Not sure about this either, I deliberately made bokeh a bit larger, because axes, legends, colorbars can eat into the actual plot space and because interactive plots have to be slightly larger to be usable. |
@jbednar @philippjfr The |
@philippjfr I recommend merging once the tests are green so we can get the most obvious changes in. We can always add further changes in a subsequent PR once we decide about other details e.g gridlines and show_frame. |
That said, a website build with the new style would be good to make sure we are happy with the current set of changes! |
Tests are going green which means style_17=True is working - or at least display output hasn't changed for this particular PR. I can add more style changes as long as they are quick and uncontroversial! |
I'll be pushing a fix to the color cycle, restoring the short 5 color cycle we have been using. An issue about extending the color cycle has been filed (#1591). |
@philippjfr I think these are enough changes that we should merge now and then use these in our rebased documentation PR. |
Okay, the new styles look a whole lot better. I'll merge now and we can make tweaks later if we need to. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR is for style changes and fixes that are bound to break the display tests. We could use this PR to update styles in general for 1.8.