Newb here with Gnuplot. I tried just testing it with a simple plt
script as per below but get the error when using it interactively (there is no output or error message when using it non-interactively). I have tested with plot sin(x)
interactively and that worked.
The script is as follows:
set xdata time
set timefmt "%Y-%m-%d"
set format x "%Y-%m-%d"
set xlabel "Date"
set ylabel "Value"
set title "Decimal Values Over Time"
plot 'data.txt' using 1:2 with linespoints
The input data is a simple 2 columns, space-delimited and the first column is a date and the second column a decimal value.
2023-02-01 60
2023-03-01 30
2023-04-01 55
I have actually been trying to plot a much more complex file (where it had multiple inputs and decimal values as percentages etc) without success and always having this same error. So I tried this simpler input just to see and still no luck. It's weird that the plot sin(x)
worked.
I'm now just trying to create a simple line chart with these values over the dates (i.e. dates on x and values on y and then a line joining each).
I have also done a full upgrade on my system etc. my Debian is using version Version 5.4 patchlevel 1.
Edited : to add more detail based on the qwuestions below.
testplot.gnuplot
data.txt
I first executed from the CLI like this $gnuplot -c testplot.gnuplot
and I saw no output. Then I tried interactive via $gnuplot
and once in interactive mode, used load testplot.gnuplot
where I saw the error as per the subject line.Any ideas on how I can make this work or where I am doing something wrong?
In the gnuplot console simply put your filename into quotes:
load "testplot.gnuplot"
Check help load
:
Syntax: load "<input-file>" The name of the input file must be enclosed in quotes.
Furthermore:
In the operating system CLI, use the option -p
for persistent
, in the gnuplot-console check help command line options
. So, something like:
gnuplot -p -c Testplot.gnuplot
Here, the filename can be with or without quotes.