Search code examples
plotgnuplot

gnuplot: how to set the size of the points according to the grid


I have the following 'data.dat' file:

#      x                 y                   z                  radius
  -1.64905083         -1.14142799         -2657.88232          177.358566    
  -449.735321          416.586914         -2865.25366          10.0000000    
   178.955292         -256.291138         -2856.96069          89.9588394
  -336.942322          184.932343         -2839.22876          90.6131058    
  -443.635315         -80.0183029         -2863.29077          70.7404404    
   236.385406          349.893188         -2901.33984          10.0000000    
   485.313416         -366.513947         -2868.35083          10.0000000    

with the positions of the spheres and their radii.

My file.p reads:

set terminal png size 500,500
set output 'file.png'
set multiplot
set xrange [-1000:1000]
set yrange [-1000:1000]
set zrange [-3000:-2500]
splot "data.dat" using 1:2:3:4 ps variable pt 7
splot -(3000**2-x**2-y**2)**(0.5) 

but the dots that gnuplot provides me are much bigger. I understand that it is because ps yields points that are radius times bigger than the normal size. Meaning that ps does not allow to set the radius of the dots, but rather how many times bigger it is than the normal points. How can I set the radius of the points please ?


Solution

  • Use "with circles" rather than "with points pt 7".

    From the manual:

    gnuplot> help with circles
    
     The `circles` style plots a circle with an explicit radius at each data point.
     The radius is always interpreted in the units of the plot's horizontal axis
     (x or x2).  The scale on y and the aspect ratio of the plot are both ignored.
     If the radius is not given in a separate column for each point it is taken from
     `set style circle`.  In this case the radius may use graph or screen coordinates.
    
     Many combinations of per-point and previously set properties are possible.
     For 2D plots these include
    
         using x:y
         using x:y:radius
         using x:y:color
         using x:y:radius:color
         using x:y:radius:arc_begin:arc_end
         using x:y:radius:arc_begin:arc_end:color
    
     By default a full circle will be drawn.  It is possible to instead plot arc
     segments by specifying a start and end angle (in degrees) in columns 4 and 5.
    
     A per-circle color may be provided in the last column of the using specifier.
     In this case the plot command must include a corresponding variable color
     term such as `lc variable` or `fillcolor rgb variable`.
    

    enter image description here