|
From: Ethan A M. <eam...@gm...> - 2018-10-28 20:09:01
|
On Sunday, 28 October 2018 12:53:35 theozh wrote:
> It should be a rather simple task, but I have several problems (using gnuplot 5.2rc4, Win7)
> Imagine the following data:
>
$Data <<EOD
xxxx ColA ColB ColC ColD
Row1 1.10 1.20 1.30 1.40
Row2 2.10 2.20 2.30 2.40
Row3 3.10 3.20 3.30 3.40
Row4 4.10 4.20 4.30 4.40
EOD
>
> The tasks and questions are:
> 1. plot circles with size which correspond to the datanumber and at a position which correspond to the number of col and row of datafield
So you want column# for x and row# for y?
set key autotitle columnhead # Tells gnuplot the first row is not data
unset key # But we aren't really using it for the key
set xrange [0:5]; set yrange [0:5]
plot for [j=2:5] $Data using (real(j-1)):($0+1):(column(j)/10.) with circles
> 2. take ytics from the first column
Same plot command but add :ytic(1)
> 3. take xtics from the first row
Same plot but add :xtic(columnhead(j))
> 4. the number of columns can depend on the datafile. How to autmatically account for this?
set key autotitle columnhead
unset key
set style data circles
set xrange [0:5]; set yrange [0:5]
plot for [j=2:*] $Data using (real(j-1)) \
: (column(0)+1) \
: (column(j)/10.) \
: ytic(1) \
: xtic(columnhead(j))
> 5. how to adjust the right xrange and yrange (i.e., such that the Row1 and Row2 ytics are not at the very edge of the graph.
>
> ad 1. ok
> ad 2. ok
> ad 3. how do I put columnheader not as key but as xtics? Had no success with columnhead(x)
> ad 4. if I use plot for [i=2:*] $Data... gnuplot get's stuck and does not respond anymore. Why? How to solve?
That was a bug in the original 5.2 release. Fixed in 5.2.1
If you are stuck with 5.2.0 then a work-around would be to determine
the number of columns first and use that explicitly rather than using *.
Ethan
> ad 5. maybe there is a way without doing stats $Data first?
>
> I tried with the code below. Thank you for hints.
>
>
> ### gnuplot code
> reset session
>
> $Data <<EOD
> xxxx ColA ColB ColC ColD
> Row1 1.10 1.20 1.30 1.40
> Row2 2.10 2.20 2.30 2.40
> Row3 3.10 3.20 3.30 3.40
> Row4 4.10 4.20 4.30 4.40
> EOD
>
> stats $Data u 0 nooutput
> set yrange[STATS_min-0.5:STATS_max-0.5]
>
> plot for [i=2:5] $Data u (i-2):0:(column(i)/10.):ytic(1) every ::1 with circles notitle
> ### end code
|