Histogram using gnuplot?
By : Gal Attila
Date : March 29 2020, 07:55 AM
To fix the issue you can do I know how to create a histogram (just use "with boxes") in gnuplot if my .dat file already has properly binned data. Is there a way to take a list of numbers and have gnuplot provide a histogram based on ranges and bin sizes the user provides? , yes, and its quick and simple though very hidden: code :
binwidth=5
bin(x,width)=width*floor(x/width)
plot 'datafile' using (bin($1,binwidth)):(1.0) smooth freq with boxes

Gnuplot histogram
By : ted
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I have created a histogram for some data that I have in a .dat file using the , You can use the stats command to get the number of entries. code :
stats 'file'
binwidth=...
bin(x,width)=width*floor(x/width)
plot 'file' using (bin($1,binwidth) + binwidth/2):(1.0/STATS_records) smooth freq with boxes
plot 'file' using (bin($1,binwidth) + binwidth/2):(100.0/STATS_records) smooth freq with boxes

histogram in gnuplot vs histogram in unix utilities
By : user3666184
Date : March 29 2020, 07:55 AM
hop of those help? smooth frequency renders the data monotonic in x (i.e. the value given in the first using column, in your case the numerical value from column 6), and then sums up all yvalues (the values given in the second using column). Here you also give the the sixth column, which is wrong if you want to count the number of occurrences of each distinct value in the sixth column, use using 6:(1), i.e. the numerical value 1 in the second column, to count the actual number of occurrences of each value: code :
set style fill solid noborder
set boxwidth 0.8 relative
set datafile separator ','
plot 'nupic_out.csv' using 6:(1) smooth frequency with boxes notitle
set datafile separator ','
set table 'tmp.dat'
plot 'nupic_out.csv' using 6:(1) smooth frequency with lines
unset table
plot 'tmp.dat' using (strcol(3) eq "i" ? $1 : 1/0):2 with boxes
plot '< head n2 tmp.dat' using 1:2 with boxes
set style fill solid noborder
set boxwidth 0.8 relative
set datafile separator ','
set table 'tmp.dat'
plot 'nupic_out.csv' using 6:(1) smooth frequency with lines notitle
unset table
set datafile separator whitespace
set logscale y
set yrange [0.8:*]
set autoscale xfix
plot '< head n2 tmp.dat' using 1:2 with boxes notitle
plot 'nupic_out.csv' using (bin($6)):(1) smooth frequency with lines
set style fill solid noborder
set datafile separator ','
set boxwidth 0.09 absolute
Min = 0.05
Max = 1.05
n = 11.0
width = (MaxMin)/n
bin(x) = width*(floor((xMin)/width)+0.5) + Min
set table 'tmp.dat'
plot 'nupic_out.csv' using (bin($6)):(1) smooth frequency with lines notitle
unset table
set datafile separator whitespace
set logscale y
set xrange [0.05:1.05]
set tics nomirror out
plot '< head n2 tmp.dat' using 1:2 with boxes notitle

Gnuplot histogram 3d
By : Ct Ct Ct
Date : March 29 2020, 07:55 AM
hop of those help? This second answer is distinct from my first. Whereas the first addresses what the OP was trying to accomplish, this second provides an alternative approach which address the underlying problem the OP was trying to overcome. I have posted an answer that addresses the ability to do this in 3d. However, this isn't usually the best way to do this with multiple histograms like this. A 3d graph like that will be difficult to compare. code :
Index Angle
0 85.0804
1 92.2482
2 90.0384
3 99.2974
4 87.729
5 94.6049
6 86.703
7 97.9413
plot datafile1 u (binwidth*(floor(($2binstart)/binwidth)+0.5)+binstart):(1) smooth freq w boxes, \
datafile2 u (binwidth*(floor(($2binstart)/binwidth)+0.5)+binstart+1):(1) smooth freq w boxes
plot datafile1 u (binwidth*(floor(($2binstart)/binwidth)+0.5)+binstart1):(1) smooth freq w boxes, \
datafile2 u (binwidth*(floor(($2binstart)/binwidth)+0.5)+binstart+1):(1) smooth freq w boxes

gnuplot: How to plot points over the bars of a clustered histogram?
By : Arun Nikethan
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , I couldn't run your code. But, based on your image, I understood you problem. To plot the points with you want, I created a file called points.dat. code :
0 2 4 8 16 32
ta22 75.67 47.98 48.16 40.91 29.24
ta23 83.69 55.59 58.59 54.20 44.19
reset # Restore the default settings
set encoding utf8 # Selects the character encoding
set terminal pngcairo size 800,500 # Generates output in png
set output 'histogram.png' # The filename
set grid ytics ls 1 lc 'gray' # Grid lines ytics only
set yrange [0:100] # Yrange 0 to 100 (% ?)
set style data histograms # Type of data: histograms
set style histogram clustered gap 1 # Type of histogram: clustered with gap 1
set style fill transparent solid 1 border lt 1 # Style: fillstyle and border
stats 'points.dat' skip 1 matrix nooutput # Statistical summary with skip
# for header and without output
numRows = STATS_size_y # Y size of matrix (rows)
numCols = STATS_size_x # X size of matrix (columns)
array Value[numRows*(numCols1)] # Create an array based on size of data
position = 0 # Count to position on array
# Loop for populate the array
do for [i=1:numRows]{
do for [j=2:numCols]{
# Statistical summary (with skip for header) at each value and without output
stats 'points.dat' skip 1 u j every ::i1::i1 nooutput
position = position + 1 # Increase the count of position
Value[position] = STATS_min # Define the arrayvalue as result of statistical analysis
}
}
# Mapping functions:
# icluster/rows (xvalues),
# jcolumn (yvalues)
# ignore the cluster name ($1)
posX(i, j) = (i  1) + 1.0*(j  numCols + 3)/numCols # To Xvalues
posY(i, j) = i == 1 ? Value[j] : Value[numCols  1 + j] # To Yvalues
# The plot itself as newhistogram and nested loops:
# iloop to bars and title as columnheade
# jloop to rows (xvalues)
# kloop to columns (yvalues)
plot \
newhistogram ,\
for [i=2:numCols]\
'data.dat' u i:xticlabels(1) ls i1 title columnheade,\
for [j=1:numRows] \
for [k=1:numCols1] \
'+' u (posX(j, k)):(posY(j, k)) w p pt 5 ps 0.75 lc 'black' notitle

