gnuplot 中堆叠的自动合并直方图
Stacked auto-binned histograms in gnuplot
有ways to have gnuplot bin your data for you个围绕着
binwidth=5
bin(x,width)=width*floor(x/width)
plot 'datafile' using (bin(,binwidth)):(1.0) smooth freq with boxes
还有ways to plot stacked histograms from pre-binned data,正在使用
set style data histogram
set style histogram rowstacked
plot 'test.dat' using 2:xtic(1) title 'Col1', '' using 3 title 'Col2'
有没有办法两全其美?我可以
plot 'a.dat' using (bin(,binwidth)):(1.0) smooth freq with boxes lc 'red' ,\
'b.dat' using (bin(,binwidth)):(1.0) smooth freq with boxes lc 'blue'
但是如果我 set style fill solid
第一个图被绘制了。
您可以将平滑后的数据写入外部文件,然后将此临时文件绘制为直方图:
binwidth=5
bin(x,width)=width*floor(x/width)
set table 'temp.dat'
plot 'a.dat' using (bin(,binwidth)):(1.0) smooth freq, \
'b.dat' using (bin(,binwidth)) smooth freq
unset table
set style data histogram
set style histogram rowstacked
plot 'temp.dat' using 2:xtic(1) index 0 title 'a.dat', '' using 2 index 1 title 'b.dat'
a.dat
和b.dat
的两个平滑图都保存在文件temp.dat
中,由两个空行分隔。因此,可以使用 index
选项访问它们以进行绘图。
有ways to have gnuplot bin your data for you个围绕着
binwidth=5
bin(x,width)=width*floor(x/width)
plot 'datafile' using (bin(,binwidth)):(1.0) smooth freq with boxes
还有ways to plot stacked histograms from pre-binned data,正在使用
set style data histogram
set style histogram rowstacked
plot 'test.dat' using 2:xtic(1) title 'Col1', '' using 3 title 'Col2'
有没有办法两全其美?我可以
plot 'a.dat' using (bin(,binwidth)):(1.0) smooth freq with boxes lc 'red' ,\
'b.dat' using (bin(,binwidth)):(1.0) smooth freq with boxes lc 'blue'
但是如果我 set style fill solid
第一个图被绘制了。
您可以将平滑后的数据写入外部文件,然后将此临时文件绘制为直方图:
binwidth=5
bin(x,width)=width*floor(x/width)
set table 'temp.dat'
plot 'a.dat' using (bin(,binwidth)):(1.0) smooth freq, \
'b.dat' using (bin(,binwidth)) smooth freq
unset table
set style data histogram
set style histogram rowstacked
plot 'temp.dat' using 2:xtic(1) index 0 title 'a.dat', '' using 2 index 1 title 'b.dat'
a.dat
和b.dat
的两个平滑图都保存在文件temp.dat
中,由两个空行分隔。因此,可以使用 index
选项访问它们以进行绘图。