How to draw objects (rect) from a file

In gnuplot, I can draw a rectangle through

set object rect from x0,y0 to x1,y1 

How to read coordinates x0, x1, y0, y1 from a file?

+4
source share
2 answers

One way is to put a line of code that sets the rectangle into a separate file and call that file from the gnuplot script. So you have a file called "coord.txt" that contains one line

 set object rect from 2,2 to 4,40 

and you have a gnuplot script called "rect.gp" that says

 set title "call rectangle coordinates" load "coord.txt" plot x**2 

If you are now inside the gnuplot type load "rect.gp" , you get your graph with a rectangle.

This may not be exactly what you are looking for, but perhaps the first step.

+1
source

You probably need to save the data from the file into variables, and then use these variables to locate the objects. As far as I know, the way to do this is not . See here . Good luck

0
source

Source: https://habr.com/ru/post/1386534/


All Articles