On Saturday, 08 August 2015 09:39:16 AM tar...@gm... wrote:
>
> Hi,
> I'm trying to build a sort of bar-chart using a simple
> data file (data_dlex) containing only 0 or 1. I'm using the following code:
>
> set style histogram rowstacked title textcolor lt -1
> set datafile missing 'nan'
> set style data histograms
>
> plot '.data_dglob' using 2:xticlabel(1) lt -1 ,\
> '.data_dlex' using ( $2==0 ? 1 : 0 ) ls 17 title 'NA' ,\
> '' using ( $2==1 ? 1 : 0 ) ls 1 ,\
> for [i=3:19] '.data_dlex' using ( column(i)==0 ? 1: 0) ls 17 notitle ,\
> for [i=3:19] '' using ( column(i)==1 ? 1: 0) ls i-1
>
> where the last two commands iterate over a potentially large number of
> columns stacking white or colored boxes depending on the value of column
> (i). To keep the same color order among different columns I would need to
> merge the two iterations into a single one with two commands.
>
> Is it possible? Any suggestion on how to do that?
The color sequence of the two histogram plots can be controlled
by prefixing each with the "newhistogram" command.
E.g.
plot 'data' using ... ,\
newhistogram lt 1, for [i=3:19] 'data2' ..., \
newhistogram lt 1, for [i+3:19] '' ...
Ethan
|