-
Notifications
You must be signed in to change notification settings - Fork 252
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
Multiple Category Axis #1310
Comments
For the plot linked above, you can do: using DataFrames, Gadfly
groups = vcat(fill.(["Mechanical", "Electrical", "Hydraulic"], [3,5,3])...)
components = ["Gear", "Bearing", "Motor", "Electrical\nSwitch", "Plug", "Cord", "Fuse",
"Bulb", "Hydraulic\nPump", "Leak", "Seals"]
rates = [11, 8, 3, 19, 12, 11, 3, 2, 4, 3, 1]
df = DataFrame(group = groups, component=components, rate=rates)
p1 = plot(df, x=:component, y=:rate, color=:group, Geom.bar, Theme(bar_spacing=1mm),
Guide.xlabel("Mechanical\t\t\t\tElectrical\t\t\tHydraulic "))
If the "components" were the same for the different groups, try |
@alecloudenback if the example above solves your problem can you please close this issue? thanks. |
Thanks! I appreciate getting it to work on the one example linked, but I thought that since the workaround was very manual that it would still be nice to have better support for this type of plotting built in. |
Here's what currently happens with # df same as above
plot(df, x=:component, y=:rate, xgroup=:group, color=:group,
Geom.subplot_grid(Geom.bar, free_x_axis=true),
Theme(bar_spacing=1mm), Guide.xlabel(nothing)
) The issue is that the subplot x scales are not proportional (so the bars are of different width). Thus this is the same issue as #1093. |
Feature Request: Plotting with different groups/layers on the axis.
https://peltiertech.com/chart-with-a-dual-category-axis/
The text was updated successfully, but these errors were encountered: