gnuplot easy histogram

hello experts,

I have been trying to plot a histogram of a data like;

-54
-56
-43
-65
-67
-78
...

I have 156.000 rows of these kind of values between 0 and -100. I just want to make x axis takes values 5 spacing in between like;

-100 -95 -90 .............. 0

And I want y axis to show how many times these values occur. I tried many things but it always shows every single value between -100 and 0. I simply would like to see the distribution

Any help would be much appreciated. Thank you.

How about something like this:

clear
reset
set key off
set border 3
set auto
 
set xrange[0:-100]
set xtics 5
 
# Make some suitable labels.
set title "Demo graph"
set xlabel "Value"
set ylabel "Count"
 
set terminal png enhanced font arial 14 size 800, 600
ft="png"
# Set the output-file name.
set output "enes.".ft
 
set style histogram clustered gap 1
set style fill solid border -1
 
binwidth=5
set boxwidth binwidth
bin(x,width)=width*floor(x/width) + binwidth/2.0
 
plot 'values.dat' using (bin($1,binwidth)):(1.0) smooth freq with boxes

It is perfect actually. Thank you very much for helping.

---------- Post updated at 08:21 AM ---------- Previous update was at 05:36 AM ----------

Hello again,

I have one thing more also I am struggling a lot to plot it. My actual data is as follows;

1724836 7450227 -64
1724830 7450229 -86
1724825 7450231 -87
1724821 7450233 -88
1724817 7450235 -88
1724812 7450237 -84
1724780 7450163 -79
1724787 7450165 -64
1724794 7450168 -73
1724802 7450171 -76
...

going like this....

I am treating the data as an X,Y coordinate and first value is X and the second Y. I have a static point like (1724850,7450200). What I want is to draw a line between each X,Y and my static point. Also while drawing the line I want to make some specification; if the third field value is bigger than -70, I want to draw it green. If it is between -70 and -85, yellow and if it is smaller than -85, red.

I tried to use arrow command of gnuplot but I could not succedd. I am trying hard to plot this data in this way.

Any help is much appreciated again, thank you.

---------- Post updated at 09:30 AM ---------- Previous update was at 08:21 AM ----------

Here is my code but it gives nothing, only a blank page;

#!/usr/local/bin/gnuplot -persist
set terminal png large size 1920,1200
set output '003A98B70A10_coverage.png'
set grid
set origin 1724850,7450200
set xrange [1724000:1724400]
set isosample 150
set palette defined (-100 "red", -95 "yellow", -85 "green")
plot "003A98B70A10.log" with impulses
# EOF

It should give multiple lines drawn from the origin point to the multiple other points.

---------- Post updated at 05:08 PM ---------- Previous update was at 09:30 AM ----------

I also tried to use 'set arrow' command but properties for that command does not seem to take data from file....

Firstly the X,Y coordinates need to be converted to polar (angle, radius) coordinates. Remember Pythagoras' theorem from school? Bet you thought you would never need that stuff! Anyway, atan2(y,x) and sqrt(x^2 + y^2) will do the job for you.

Also origin moves the graph on the page, it dosn't change the point that the impulse plot uses, I don't really know if this can be done. I just subtracted the origin values from your X,Y coordinates in the geta (get-angle) and getr (get-radius) functions:

#!/usr/bin/gnuplot -persist
set terminal png large size 1920,1200
set output '003A98B70A10_coverage.png'
set polar
set grid
set xrange [-200:200]
set yrange [-200:200]
set isosample 150
set palette defined (-100 "red", -95 "yellow", -85 "green")
xorig=1724850
yorig=7450200
geta(x,y)=atan2(y-yorig,x-xorig)
getr(x,y)=sqrt((x-xorig)*(x-xorig) + (y-yorig)*(y-yorig))
plot "003A98B70A10.log" using (geta($1,$2)):(getr($1,$2)):3 with impulses palette notitle

yep, I never thought I would use that formula but in polar case, I need to use. Thanks for the help and information. I have found a different answer also. Here I learned that you can directly use as vectors;

set terminal png large size 1920,1200
set output '003A98B70A10_coverage.png'
set grid
set origin 1724012,7451336
set isosample 150
set palette defined (-100 "red", -95 "yellow", -85 "green")
plot "003A98B70A10.log" using 1:2:(1724012-$1):(7450200-$2):3 with vectors palette

which is similar to your logic, subtracting the values from the origin.

Thanks in advance again.