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

Restructure plotting #1312

Merged
merged 56 commits into from
Aug 4, 2020
Merged

Restructure plotting #1312

merged 56 commits into from
Aug 4, 2020

Conversation

ahartikainen
Copy link
Contributor

Restructure plotting.

backend related defaults to backend code.

@canyon289
Copy link
Member

@ahartikainen Do you need help with this? Seems like theres a lot going on

@ahartikainen
Copy link
Contributor Author

Sure if you have time.

I will continue when I have some time.

Basically there is couple of lines in each main plot function that is moved to backend functions, and then some of the inner kw are changed.

Then there is still a lot to do. I will add discussion here when the time is right.

@ahartikainen ahartikainen force-pushed the restructure/plotting branch from 51a8a0c to 3f5f515 Compare July 30, 2020 06:45
@codecov
Copy link

codecov bot commented Jul 30, 2020

Codecov Report

Merging #1312 into master will decrease coverage by 0.05%.
The diff coverage is 96.47%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1312      +/-   ##
==========================================
- Coverage   93.00%   92.94%   -0.06%     
==========================================
  Files         101      101              
  Lines       10115    10184      +69     
==========================================
+ Hits         9407     9466      +59     
- Misses        708      718      +10     
Impacted Files Coverage Δ
arviz/plots/autocorrplot.py 100.00% <ø> (ø)
arviz/plots/backends/bokeh/distcomparisonplot.py 100.00% <ø> (ø)
arviz/plots/backends/bokeh/kdeplot.py 93.33% <ø> (ø)
arviz/plots/backends/matplotlib/forestplot.py 97.93% <ø> (ø)
arviz/plots/backends/matplotlib/kdeplot.py 97.46% <ø> (ø)
arviz/plots/bpvplot.py 79.24% <ø> (+2.10%) ⬆️
arviz/plots/densityplot.py 90.00% <ø> (-1.94%) ⬇️
arviz/plots/distcomparisonplot.py 92.30% <ø> (-2.94%) ⬇️
arviz/plots/elpdplot.py 100.00% <ø> (ø)
arviz/plots/essplot.py 100.00% <ø> (ø)
... and 58 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ae0138c...8edd4e7. Read the comment docs.

@canyon289
Copy link
Member

Wow @ahartikainen you did it. Is this still in draft stage? I'm dying to hit that merge button

@ahartikainen
Copy link
Contributor Author

It still in draft. There are some normalization to be done

@ahartikainen ahartikainen marked this pull request as ready for review August 1, 2020 21:11
@ahartikainen
Copy link
Contributor Author

Ready for review.

This PR enables mpl=>3.3 and doesn't change the user-interface.

Copy link
Member

@OriolAbril OriolAbril left a comment

Choose a reason for hiding this comment

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

Thanks for all the work!

arviz/plots/backends/bokeh/bpvplot.py Outdated Show resolved Hide resolved
arviz/plots/backends/bokeh/bpvplot.py Outdated Show resolved Hide resolved
arviz/plots/backends/bokeh/densityplot.py Outdated Show resolved Hide resolved
plot_ref_kwargs.setdefault("line_color", "black")
plot_ref_kwargs.setdefault("line_dash", "dashed")
else:
plot_ref_kwargs.setdefault("alpha", 0.1)
Copy link
Member

Choose a reason for hiding this comment

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

not sure if we should use alpha or line_alpha, in fact, not even sure if we should create a bokeh dealiaser too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bokeh kwargs are currently a mess, so I didn't touch them for now.

Also most bokeh kwargs are currently called explicitly

Copy link
Member

Choose a reason for hiding this comment

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

Let's leave it like this then

arviz/plots/backends/bokeh/densityplot.py Outdated Show resolved Hide resolved
arviz/plots/backends/matplotlib/loopitplot.py Outdated Show resolved Hide resolved
arviz/plots/backends/matplotlib/ppcplot.py Outdated Show resolved Hide resolved
arviz/plots/backends/matplotlib/traceplot.py Outdated Show resolved Hide resolved
arviz/plots/bpvplot.py Outdated Show resolved Hide resolved
arviz/plots/energyplot.py Outdated Show resolved Hide resolved
@ahartikainen
Copy link
Contributor Author

@OriolAbril @canyon289 I'm starting to think that maybe we should move closer to "native" bokeh settings and colors.

This would mean that we don't change "red" to mpl red but use bokeh red. We could have handling for special colors

C0-C9 --> let's fix this by our selves
`red_matplotlib` or `red_mpl` --> force mpl colors? 

@ahartikainen ahartikainen force-pushed the restructure/plotting branch from bd169e9 to 25181ce Compare August 3, 2020 06:40
@OriolAbril
Copy link
Member

OriolAbril commented Aug 3, 2020

For base colors, both libraries use CSS colors so red is exactly the same color for mpl and for bokeh. https://docs.bokeh.org/en/latest/docs/reference/colors.html#bokeh-colors-named and https://matplotlib.org/3.1.0/gallery/color/named_colors.html

The conversion using mpl helpers has the advantage that then, in addition to CSS colors, all the following are also supported:

  • C0... so that defaults easily mute when changing the stylesheet
  • single letter colors
  • tableau colors
  • xkcd colors

Note: xkcd:red can be different than CSS red

@ahartikainen
Copy link
Contributor Author

Ok, if the colors are the same, I'm fine with the helper function.

@canyon289
Copy link
Member

I'll take a look at this in next ~24 hours but dont let me block a merge either

@canyon289
Copy link
Member

I dont want there to be a merge conflict so I'm going to merge this and keep reviewing. If stuff comes up I'll make an issue ticket

@canyon289 canyon289 merged commit 4c9fb4f into master Aug 4, 2020
@OriolAbril OriolAbril deleted the restructure/plotting branch August 4, 2020 08:33
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.

3 participants