Hi there I need some help drawing a simple triangle
library(ggplot2)
library(data.table)
dt.triangle <- data.table(group = c(1,1,1), polygon.x = c(2,4,4), polygon.y = c(1,1,3))
p <- ggplot()
p <- p + geom_polygon(
data = dt.triangle
,aes(
x=polygon.x
,y=polygon.y
,group=group
)
)
p
I'm not that satisfied with the drawing/rendering of the hypotneuse, somehow I want to draw a line that doesn't show this "saw teeth".
Do I miss something?
For some reason I want to use ggplot2 in combination with geom_polygon.
Any help is appreciated
Tom
The effect is because the default rendering engine doesn't use anti-aliasing. If you save as a pdf or svg it will render more smoothly.
Alternatively, you can use a Cairo
device:
library(Cairo)
CairoWin() # or perhaps CairoX11()
p
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With