Gnuplot with gnuplot-iostream and X and Y axis

39 Views Asked by At

When I use gnuplot with a simple file at C:\gnu\test.txt containing

1 1
2 4
3 9
4 16
5 25
6 36
7 49
8 64
9 81
10 100
11 121
12 144

I get the graph I expected after starting gnuplot from the command line and running.

plot 'C:\gnu\test.txt' with lines

So this works fine.

I would like to be able to do this using gnuplot-iostream where I can have control of what is on the X and Y axis.

Something roughly along the lines of

Gnuplot gp; 

gp << "plot 'C:\\gnu\\test.txt' using 1:2 with lines";

or

gp << "plot '-' using 1:2 with lines";

gp.send1d(data with x and y axis); 

If you catch my drift.

I really do not understand what appears to me to be something simple.

1

There are 1 best solutions below

1
Tom Solid On

You have forgot to add an end-line character at the end of your commands, eg:

gp << "plot 'C:\\gnu\\test.txt' using 1:2 with lines\n";

For further readings, there is the documentation