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

Horizontal bar plots are off center #1588

Open
Brinkhuis opened this issue Jun 1, 2022 · 0 comments
Open

Horizontal bar plots are off center #1588

Brinkhuis opened this issue Jun 1, 2022 · 0 comments

Comments

@Brinkhuis
Copy link

Horizontal bar plots are off center while vertical bar plots work just fine.
[Julia 1.7.3 and Gadfly 1.3.4]

using CSV, DataFrames, Statistics, Gadfly

download("https://raw.githubusercontent.com/mwaskom/seaborn-data/master/penguins.csv", "penguins.csv")
penguins = DataFrame(CSV.File("penguins.csv"))

set_default_plot_size(16cm, 12cm)

plot(
    combine(groupby(dropmissing(penguins), [:species, :sex]), :body_mass_g .=> mean .=> :body_mass_g),
    x = "species", 
    y = "body_mass_g", 
    color = "sex", 
    Geom.bar(orientation = :vertical),
    Theme(bar_spacing = 15mm, background_color = "white",)
)

Screenshot 2022-06-01 at 09 21 52

plot(
    combine(groupby(dropmissing(penguins), [:species, :sex]), :body_mass_g .=> mean .=> :body_mass_g),
    x = "body_mass_g", 
    y = "species", 
    color = "sex", 
    Geom.bar(orientation = :horizontal),
    Theme(bar_spacing = 15mm, background_color = "white",)
)

Screenshot 2022-06-01 at 09 23 31

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

No branches or pull requests

1 participant