How to set point type from data in gnuplot?

How to set data type from data in gnuplot?

gnuplot script:

set terminal pngcairo size 640,480
set output "points.png" 
set style data points 
set auto x 
set autoscale x 
unset colorbox 
plot 'test.data' using 2:1 with points notitle

test.data p>

32  35  8
34  34  6
36  28  1
34  32  2
28  30  7
38  30  9
34  29  2
35  36  9
39  34  3
31  33  9
28  31  6
35  30  5
33  41  4
32  37  3

how to get point type from 3 columns?

plot 'gnuplot.data' using 2:1 with points pt (:3) notitle // error 

Abstraction example:

enter image description here

necessary:

enter image description here

gnuplot Version 4.6 patchlevel 4

+4
source share
1 answer

It is not possible to select a point type from a column-based data file (equivalent to linecolor variable, pointsize variableor arrowstyle variable). Basically, you have two options:

  • Iterate over all possible types of points (which you can extract using statsif it should be a variable), and for each number display only those points that correspond to the current type of point:

    stats 'test.data' using 3 nooutput
    unset key
    set style data points
    plot for [i=STATS_min:STATS_max] 'test.data' using 2:($3 == i ? $1 : 1/0) lt 1 pt i ps 2
    

enter image description here

  1. labels , , . ( http://www.shapecatcher.com http://decodeunicode.org/en/geometric_shapes, )

    unset key
    set encoding utf8
    symbol(z) = "•✷+△♠□♣♥♦"[int(z):int(z)]
    plot 'test.data' using 2:1:(symbol($3)) with labels textcolor lt 1
    

enter image description here

+6

All Articles