Skip to content
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

Add mpl-like template #1864

Merged
merged 16 commits into from
Nov 7, 2019
Merged

Conversation

joelostblom
Copy link
Contributor

@joelostblom joelostblom commented Nov 4, 2019

@nicolaskruchten The PR is finally here! There are still a few things to test, but please have a look nd let me know if this makes sense so far. Notably, I still have to tend to these items

I suggest naming this template mpl as a reference to the default style in matplotlib. The most notable difference would be that the top and rightmost axis lines are omitted here whereas matplotlib plots full boxes around the plots by default. The ticks, bg color, and color rotations are all the same as the default matplotlib style (altuogh I kept gray14 as the black color for now). I thought it made sense with this consistency so I included Viridis as the default color map instead of Inferno or Blues which I would be more likely to choose myself. For complete adherence, I could add the full box and then make another template called "despine" or similar to remove the topmost and rightmost axis lines.

I would also be happy to call this template xticks or axes lines and be more liberal in some of the choices, let me know what you think makes the most sense.

Some screens:
image

image

image

image

close #1834

@emmanuelle
Copy link
Contributor

How about naming the template simple_white or basic_white ?

@joelostblom
Copy link
Contributor Author

Sounds good to me, I think I would prefer "simple" over "basic", and open to other suggestions also.

Any idea why the axes lines are hidden in scatter matrices? I have not been able to find how to make it read the layout from the template instead of defaulting to hiding axes, but no luck so far.

image

@nicolaskruchten
Copy link
Contributor

Let's go with simple_white then.

The reason you don't get axis lines in the inner plots in a SPLOM is that there aren't any axes there. Unlike the output of make_subplots wherein every subplot has its own X and Y axes that lock using matches, in a SPLOM each column shares an X axis (physically located at the bottom) and each row shares a Y axis (on the left) so those are the only places you'll ever see a line.

@joelostblom
Copy link
Contributor Author

Done! I wont add any new things now, just fix what you think need fixing. This is what the scatter matrix looks like with the added transparency.

image

Ideally I would remove the upper half and show histograms on the diagonal, but I suspect that would be too much alteration in an official template so I will make those changes locally instead.

@nicolaskruchten
Copy link
Contributor

I don't think I'm a fan of the opacity changes to scatter... none of our other templates do this and I'd like for there to be at least some measure of consistency about this :)

@nicolaskruchten
Copy link
Contributor

I also think the lines around the bars are too strong... can we use the same thickness as in the plotly template family please?

@joelostblom
Copy link
Contributor Author

I don't think I'm a fan of the opacity changes to scatter... none of our other templates do this and I'd like for there to be at least some measure of consistency about this :)

I think it is a useful way to indicate saturated plots, but I also get your points about consistency, removed.

I also think the lines around the bars are too strong... can we use the same thickness as in the plotly template family please?

Hmm, doesn't the plotly templates use 0 linewidth? I changed it to 0.6 in my latest commit, looks like this:

image

@nicolaskruchten
Copy link
Contributor

This is looking pretty solid, thanks very much! Once #1875 lands we can rebase it on top of that one and then I can kick the tires a bit more and merge it in :)

Thanks for all the patience and enthusiasm on these PRs and issues over the past few weeks!

@nicolaskruchten
Copy link
Contributor

nicolaskruchten commented Nov 6, 2019

OK, if you can rebase onto master and force-push, I'll do more QA today and we can merge

@joelostblom
Copy link
Contributor Author

@nicolaskruchten Rebased

@nicolaskruchten
Copy link
Contributor

Looking really good!

Some observations from rendering the Plotly Express gallery notebook with px.defaults.template="simple_white":

  • Marginal plots in PX now have both axis lines set, which is not quite as nice as your screenshot above
  • Ternary plot axis lines are grey rather than black, which doesn't seem strictly required

These don't necessarily have to change but they're worth a think

Other than those two items, this is ready for merging!

@joelostblom
Copy link
Contributor Author

Looking really good!

Thanks!

  • Marginal plots in PX now have both axis lines set, which is not quite as nice as your screenshot above

Yes, this was a change I suggested in #1863 but it didn't make it into #1875. I created a new PR #1882.

  • Ternary plot axis lines are grey rather than black, which doesn't seem strictly required

Done

@nicolaskruchten
Copy link
Contributor

OK, I'm very happy to merge this now and we can figure out #1882 separately (hopefully still for 4.3!)

A big thank you for working through this whole thing with us :)

@nicolaskruchten nicolaskruchten merged commit 643f58e into plotly:master Nov 7, 2019
@joelostblom
Copy link
Contributor Author

Thanks for helping me contribute!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add white templates with axes lines, tickmarks, and different color rotation
3 participants