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 Gadfly examples #275

Merged
merged 2 commits into from
Mar 12, 2021
Merged

Add Gadfly examples #275

merged 2 commits into from
Mar 12, 2021

Conversation

rikhuijzer
Copy link
Contributor

I have been working on moving the Gadfly plotting functionality from my package into MCMCChains.jl. However, I figured that I was basically

  1. Catching calls to Gadfly.plot(chn::Chains, args...; vargs..., filter=nothing)
  2. Converting chn to df::DataFrame
  3. Applying filter to df
  4. Invoking Gadfly.plot(df, args...; vargs...)

So, most of this could be replaced by using the DataFrames constructor provided by MCMCChains.jl. Since this is easy in use, but can be hard to figure out, I've added a few examples to the docs.

Some examples from the generated documentation:

image

image

I wonder if parts of these examples should be implemented in src. I don't think so given the relative easy of use, but am not sure about it.

What would possibly be interesting is to implement a function which uses Gadfly.hstack to show the density and trace side by side. From my package:

image

For the examples, creating such a hstack was a bit too involved.

Vertical bars for credibility intervals

On a side-note, my package was also showing vertical bars for credibility intervals, like

image

This functionality is hopefully going to be merged into Gadfly, see GiovineItalia/Gadfly.jl#1521.

Copy link
Member

@cpfiffer cpfiffer left a comment

Choose a reason for hiding this comment

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

I'm down with it, thanks!

@cpfiffer cpfiffer merged commit 3e2080f into TuringLang:master Mar 12, 2021
@storopoli
Copy link
Member

Great addition! Congratulations!

@rikhuijzer rikhuijzer deleted the df branch March 14, 2021 10:55
@mkborregaard
Copy link
Collaborator

are you replacing the StatsPlots functionality with Gadfly here?

@rikhuijzer
Copy link
Contributor Author

are you replacing the StatsPlots functionality with Gadfly here?

I don't know about the plans of the Turing developers, but I can say that that has never been my intention! I personally like Gadfly, but I also respect people who like Plots.jl. I think both plotting libraries have their strengths and weaknesses.

@mkborregaard
Copy link
Collaborator

So loading Gadfly here would not break the session for Plots users (due to conflicting definitions of plot)?

@cpfiffer
Copy link
Member

are you replacing the StatsPlots functionality with Gadfly here?

No, we have no intention of replacing StatsPlots with Gadfly. This stuff is only loaded if someone really wants to use Gadfly -- we don't enforce any of this in the core package code and probably won't.

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.

4 participants