Gnuplot не может прочитать файл .dat - PullRequest
0 голосов
/ 28 апреля 2020

Я создал файл в блокноте и сохранил его как файл 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"

Файл date1.dat полон данных, как я показал ранее. Есть мысли о том, как решить проблему?

1 Ответ

0 голосов
/ 28 апреля 2020

В консоли gnuplot введите pwd, которая будет печатать текущий рабочий каталог. Ваш файл находится в этом каталоге? Если нет, укажите полный путь, например,

plot 'C:/myDir/subDir/dates1.dat' ... 

или измените рабочий каталог с помощью cd. Проверьте help pwd и help cd.

...