Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filled rectangle in R

Tags:

plot

r

rect

I would like to know which function would allow me to draw filled rectangles like (or with different other fills like dots or dotted/dashed lines)

enter image description here

I am aware of the function rect(), but that function allows only for color filling. What can I try next?

like image 705
Mayou Avatar asked Oct 15 '25 08:10

Mayou


1 Answers

try density in the rect function - an example

   plot(c(100, 200), c(300, 450), type= "n", xlab = "", ylab = "")
   rect(110, 300, 175, 350, density = 5, border = "red")

you can use lty to have different types of borders and shading

example -

  rect(110, 300, 175, 350, density = 5, border = "red", lty =2)
like image 91
user2510479 Avatar answered Oct 18 '25 10:10

user2510479



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!