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

forestplot: support multiple traces #2736

Merged
merged 11 commits into from
Dec 9, 2017

Conversation

aloctavodia
Copy link
Member

@aloctavodia aloctavodia commented Nov 29, 2017

Sometimes is useful to visually compare the results/posterior for different models. One option to achieve this task is to make a forestplot for all variables in all models. This PR modifies forestplot to support either a trace or a list of traces, a new keyword models can be used to pass the names of the models

This is an example of a forestplot for several models:
multi_forestplot

model m0 does not have a beta parameter, contrary to models m1 and m2. Additionally, the beta parameter for m2has shape=2.

@fonnesbeck
Copy link
Member

It would be cool to do something to make the models stand out, such as colorize the labels by model. Conversely, I wonder if you could create shading bands to isolate the same parameters.

@aloctavodia
Copy link
Member Author

I agree, the plot is too flat. I will try to do something to make the models stand out... maybe a color per-model and also the "shading-bands"

@aloctavodia
Copy link
Member Author

Shading bands are used to help visualize groups of parameters (only when more than one trace is passed).

multi_forestplot_cb_00

Additionally, by setting colors='cycle', we get a different color per model

multi_forestplot_cb_01

Previous plots were done with the style I generally use, i.e. plt.style.use(['seaborn-colorblind', 'seaborn-darkgrid']). This is how the first plot looks with the default matplotlib style.

multi_forestplot_default

@junpenglao
Copy link
Member

WOW this is really nice!

@fonnesbeck
Copy link
Member

Yeah, that's exactly what I had in mind. Nice work.

@aloctavodia
Copy link
Member Author

Should I also add this to the release-notes?

@aloctavodia aloctavodia mentioned this pull request Dec 3, 2017
@aloctavodia
Copy link
Member Author

Is this ready to squash and merge or maybe more work is needed?

@junpenglao
Copy link
Member

This is really a nitpick but is it possible to adjust the shadow to more in the middle between two errorbars?

@aloctavodia
Copy link
Member Author

No nitpicking at all @junpenglao! This is how it looks with your suggestion.
multi_forestplot_default

@junpenglao junpenglao merged commit cff9ea9 into pymc-devs:master Dec 9, 2017
@junpenglao
Copy link
Member

Thanks @aloctavodia !

@aloctavodia aloctavodia deleted the multiforestplot branch December 9, 2017 14:37
jordan-melendez pushed a commit to jordan-melendez/pymc3 that referenced this pull request Feb 6, 2018
* forestplot: support multiple traces

* add shading bands per variable and colors per model

* add to release-notes

* set default model names is None passed, check number of models names for consistency

* ensure valid color names

* place bands inbetween errorbars
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