drawing a square from x to y coordinates in gnuplot

Viewed 226

I am trying to draw a square from a point 300 on x axis to point 300 on y axis and then from 600 on x to 600 on y. It should only be a line square, just the shape to mark the border.

I am trying this:

set palette defined ( -1.0 "blue",\
                   -0.5 "light-blue",\
                      0 "white",\
                    0.5 "light-red",\
                     1.0 "red")
                                  
set cbrange [ 1.000: -1.000]
set pm3d map corners2color c2
set ytics    1.000,  25.000
set xtics    1.000,  25.000
set object rectangle from 308 to 308 front
set xlabel "Residue"
set ylabel "Residue"
set yrange [   0.000: 926.000]
set xrange [   0.000: 926.000]

but I dont see any square as you can see in the picture. Thank you

;o

1 Answers

Please check help object and help rectangle. You have several options to give the coordinates. One would be to give the x,y coordinates of two opposing corners.

Code:

### rectangle frame in front of pm3d
reset session

set pm3d map
set obj 1 rect from -3,-3 to 3,3 front fs empty border rgb "white"

splot x*y palette
### end of code

Result:

enter image description here

Related