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

Histogram Subplots Independently Adjust Bin Size #343

Open
astrieanna opened this issue Jun 28, 2014 · 2 comments
Open

Histogram Subplots Independently Adjust Bin Size #343

astrieanna opened this issue Jun 28, 2014 · 2 comments
Labels

Comments

@astrieanna
Copy link

This code plots the iris dataset. Each subplot is a histogram; rows are species, columns are measures. The problem is that some histograms have very skinny lines and some have very thick ones; I would expect them to all look about the same with respect to width-of-bars.

using Gadfly, RDatasets
iris = dataset("datasets","iris")
iris2 = melt(iris,:Species)
set_default_plot_size(9inch, 6inch)
plot(iris2,xgroup=:variable,ygroup=:Species,x=:value,Geom.subplot_grid(Geom.histogram))
@dcjones
Copy link
Collaborator

dcjones commented Jul 1, 2014

I think now that choosing different bin counts for subplots isn't bad, just in this example it does a terrible job. I've made some improvements that should yield better results.

Can you remind me what the other histogram issue you ran into was?

@astrieanna
Copy link
Author

When you add color to Geom.bar inside a Geom.subplot_grid, the heights of the bars are all the same.

using Gadfly, RDatasets
iris = dataset("datasets","iris")
iris2 = melt(iris,:Species)

# Happy blue plot
plot(iris2,xgroup=:variable,x=:Species,y=:value,Geom.subplot_grid(Geom.bar))

# Colorful plot
plot(iris2,xgroup=:variable,x=:Species,y=:value,color=:Species,Geom.subplot_grid(Geom.bar))

screenshot from 2014-07-01 22 19 08

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

No branches or pull requests

2 participants