Plot histogram with specified patterns for different categories in GNUPLOT
I'm now gonna plot a 10-category histogram wit开发者_StackOverflowh GNUPLOT. Since number of categories is relative large, I want to specify patterns for different categories myself instead of applying the default pattern setting making different categories easy distinguished, e.g. fill the first category with dash-line while the second shaded, etc.
Is there any parameter can be employed to specify a pattern in the plot
command? Any hints/advice will be highly appreciated. Thanks in advance.
Best Regards!
You can use with boxes fs [pattern|solid] <style-id>
.
0 0.0 0.0
1 0.3 0.6
2 1.6 1.6
3 0.3 1.5
4 0.6 3.6
5 0.3 4.3
6 0.3 0.7
7 5.5 5.5
8 6.6 6.6
9 5.2 5.2
10 8.3 8.3
11 2.7 5.0
12 2.8 8.3
13 3.3 2.8
14 7.9 3.9
15 9.9 7.9
16 15.3 15.3
17 14.7 14.7
18 3.8 18.1
19 18.1 12.1
Gnuplot script:
set style data hist
set style histogram rowstacked
plot 'test.dat' us 2:xtic(1) fs solid 1 ls 3, '' us 3 fs pattern 1
See this link for more detail:
- http://t16web.lanl.gov/Kawano/gnuplot/plot5-e.html
- gnuplot fillstyle demo
It is an interesting problem. After read your question I wrote a blog to talk about it. May be you can have a look. The link is here: http://gnuplot-surprising.blogspot.com/2011/09/plot-histograms-using-boxes.html
精彩评论