【发布时间】:2020-04-28 22:53:26
【问题描述】:
我在记事本中创建了一个文件并将其保存为 ANSI 和 .dat 文件。文件结构如下:
2019 371320
2018 352137
2017 323201
2016 302271
2015 291377
2014 282730
2013 273467
2012 257093
2011 244541
2010 223488
2009 216949
2008 197778
(...)
然后打开gnuplot终端我设置了我想要的设置,在plot "dates1.dat" using 2:xticlabels(1) with boxes lt rgb "#406090"之后弹出一个错误:
Warning! Cannot find or open file "dates1.dat"
No data in plot
整体设置:
# Output to PNG, with Verdana 8pt font
set terminal pngcairo nocrop enhanced font "verdana,8" size 640,300
# Don't show the legend in the chart
set nokey
# Thinner, filled bars
set boxwidth 0.4
set style fill solid 1.00
# Set a title and Y label. The X label is obviously months, so we don't set it.
set title "Number of registrations per month" font ",14" tc rgb "#606060"
set ylabel "Registrations (thousands)"
# Rotate X labels and get rid of the small stripes at the top (nomirror)
set xtics nomirror rotate by -45
# Show human-readable Y-axis. E.g. "100 k" instead of 100000.
set format y '%.0s %c'
# Replace small stripes on the Y-axis with a horizontal gridlines
set tic scale 0
set grid ytics lc rgb "#505050"
# Remove border around chart
unset border
# Manual set the Y-axis range
set yrange [100000 to 300000]
set output "6.png"
plot "dates1.dat" using 2:xticlabels(1) with boxes lt rgb "#406090"
dates1.dat 文件中充满了我之前展示的数据。关于如何解决问题的任何想法?
【问题讨论】: