Reputation: 45
I am plotting a histogram rowstacked very similar to this graph (the last one on this page) :
What I would like to do is to have different colors for each year bin. This colors would repeat from a newhistogram to another. I have not yet found a way to do this.
An example with my data of what I am trying to accomplish is
Thank you for your help.
Upvotes: 2
Views: 694
Reputation: 48390
So what is your actual problem with this? Using the histograms
plotting should work fine. Consider the following data file
A -1 1 -0.5 0.5
B -2 2 -1 1
C -3 3 -1.5 1.5
D -4 4 -2 2
E -5 5 -2.5 2.5
F -4 4 -2 2
G -3 3 -1.5 1.5
which you can plot with
set key tmargin horizontal
set style fill solid noborder
set style data histograms
set style histogram gap 1
plot 'data.dat' using 2:xtic(1) title "First",\
'' using 4 title "Second",\
newhistogram at 0,\
'' using 3 title "Third",\
'' using 5 title "Fourth"
The result is
Here, I explicitely assume, that in one column you have only negative or only positive values. But that isn't necessary in general. All further fine-tuning depends on your actual data file format, and other, unknown, conditions.
Upvotes: 1