Gadfly.jl
Gadfly.jl copied to clipboard
How can I change the colors of bars of a bar plot? (No grouping)
Here is my plot:
display(plot(x=a, Geom.histogram(density=true, position=:dodge), Scale.x_discrete, Theme(
# bar_highlight=RGB(0,0.5,1),
bar_spacing=3mm)))
I want to color the bars randomly, without affecting the plot otherwise. Sth like colorsame
that gets a function index_of_current_element_in_color_group, group_default_color -> modified_color
would be nice. This way I can introduce some noise into each color to make them visually more salient.
I can't think of a way to do this with Geom.histogram
, as you say the color
aesthetic is used for grouping. If you calculated your own bins and counts e.g. using StatsBase, then you could use Geom.bar
and color
.
I've started PR #1428 which adds new features to Geom.bar
(and hence Geom.histogram
). Feedback welcome!
PR #1428 has been merged, so can this issue be closed?
@Mattriks I think we should keep it. The alpha noise is a good alternative solution for this, but it’s not as visually appealing as changing the colors themselves.