|
From: Ethan A M. <sf...@us...> - 2017-01-25 20:12:07
|
On Wednesday, 25 January, 2017 11:43:11 Valerio Schiavoni wrote:
> Hello,
> i'd like to assign colors to the bars of histograms according to the value
> of a given column in the input file.
The only way I can think of to do that is to make 2 passes through the data file.
Pass 1:
read in 1st column only and use it somehow to redefine linetype colors 1-N
Pass 2:
plot with histograms as usual will color by linetype with the redefined colors
> I'm using gnuplot version 5.0 patchlevel 5 on Mac OSX.
>
> The current gnuplot script is:
>
> set term post color eps 22 enhanced
> set output "single.eps"
> set size 1.9,0.65
> set lmargin 6
> set rmargin 1
> set bmargin 4
> set tmargin 2
> set style data histogram
> set style fill solid
> set style histogram clustered gap 0.05
> set datafile missing '-'
> set style fill solid
> set boxwidth 0.7
> set yrange [0:1.6]
> set xrange [-0.5:104]
> set xtics norangelimit
> # Labels
> set xtics font "Arial,15" offset +0.5 #rotate by -90
> set grid noxtics
> set grid y
> set xtics () nomirror
> set key autotitle columnhead
> unset key
>
> plot newhistogram, "data/ratio_small.txt" using ( $2):xtic(1) notitle,\
> newhistogram, "data/ratio_small.txt" using ( $3):xtic(1) notitle,\
> newhistogram, "data/ratio_small.txt" using ( $4):xtic(1) notitle,\
> newhistogram, "data/ratio_small.txt" using ( $5):xtic(1)
> notitle,\
> newhistogram, "data/ratio_small.txt" using ( $6):xtic(1) notitle,\
> newhistogram, "data/ratio_small.txt" using ( $7):xtic(1) notitle,\
> newhistogram, "data/ratio_small.txt" using ( $8):xtic(1) notitle,\
> newhistogram, "data/ratio_small.txt" using ( $9):xtic(1) notitle,\
> newhistogram, "data/ratio_small.txt" using ($10):xtic(1) notitle,\
> newhistogram, "data/ratio_small.txt" using ($11):xtic(1) notitle,\
> newhistogram, "data/ratio_small.txt" using ($12):xtic(1) notitle,\
> newhistogram, "data/ratio_small.txt" using ($13):xtic(1) notitle,\
> newhistogram, "data/ratio_small.txt" using ($14):xtic(1) notitle,\
> newhistogram, "data/ratio_small.txt" using ($15):xtic(1) notitle,\
> 1 with lines linecolor 0 linetype 6;
>
> !epstopdf single.eps
> !rm single.eps
> quit
>
> The input file ratio_small.txt is the following :
> The first column is an identifier.
> The following 14 columns have the values of the bar.
> The last 14 columns (for example "124 124 124 124 124 124 lime lime 124 124
> 124 124 124") have the colors to use for the corresponding column at the
> (i-14) place. For instance, in the 2nd row, the var with value
> 0.60237220283 should be colored with color 124.
>
>
> - "cryfs" "ecryptfs" "encfs" "lessfs" "metfs" "sdsfuse\\_aligned\\_aes"
> "sdsfuse\\_aligned\\_det" "sdsfuse\\_aligned\\_nop"
> "sdsfuse\\_aligned\\_nop\\_padded" "sdsfuse\\_fuse"
> "sdsfuse\\_nop\\_encode\\_nop\\_align" "sdsfuse\\_rep" "sdsfuse\\_xor" - -
> - - - - - - - - - - -
> "{/ZapfDingbats \300} " 0.60237220283 0.711344856725 0.582073883361
> 0.561468395169 0.603971833124 0.575229774521 0.813573769298 0.771643308547
> 0.740536179457 0.557035680285 0.548084588862 0.725980132011 0.583761565013
> 124 124 124 124 124 124 lime lime 124 124 124 124 124
> "{/ZapfDingbats \301} " 0.828140563793 0.765377304019 0.525156213021
> 0.499275338734 0.82259078758 0.810583550209 0.90517243804 0.832808370792
> 0.85616508535 0.435176869986 0.497580109525 0.980843387581 0.537928091583
> lime lime 124 red lime lime lime lime lime red red lime 124
> "{/ZapfDingbats \302}" 0.904716215072 0.9782538275 0.890741302346
> 0.854583799197 0.917847306987 0.896293508144 1.0256528681 1.0177182497
> 1.03861543433 0.828367721449 0.86518859574 0.994039596381 0.889451921888
> lime lime lime lime lime lime lime lime lime lime lime lime lime
> "{/ZapfDingbats \303} " 1.08435421701 0.908573825168 1.31416588444
> 1.20433784027 1.05710491103 1.0877693675 0.990982804418 0.861592538595
> 0.94912224641 0.9949811268 1.21051107427 0.833466477602 1.33826965709 lime
> lime lime lime lime lime lime lime lime lime lime lime lime
> "{/ZapfDingbats \304} " 0.984592491056 1.01684770897 0.881511303546
> 0.897089139514 1.03427135005 0.992558483823 1.06725668178 1.07300848486
> 1.06531720912 0.908734725952 0.861996719541 1.0868248165 0.856056225665
> lime lime lime lime lime lime lime lime lime lime lime lime lime
> "{/ZapfDingbats \305} " 0.560462965052 0.924647572034 1.36731646391
> 1.32606135282 0.640285625269 0.587394675894 1.13208012281 1.23169129299
> 1.10314905856 1.31119793361 1.27579591436 1.09900540945 1.33576106248 124
> lime lime lime 124 124 lime lime lime lime lime lime lime
> "{/ZapfDingbats \306} " 0.601744213649 0.945552385642 0.639627276921
> 0.602851791101 0.617152828593 0.538149627645 1.16342545291 1.54587559776
> 1.12360405139 0.629261782578 0.55989311075 1.16338958747 0.644274734595 124
> lime 124 124 124 124 lime lime lime 124 124 lime 124
>
> The current output is in attachment.
> Can anyone help ?
>
> Thanks a lot,
> --
> Valerio
|