خرید بک لینک

Vote count: 0

I want to add a zig-zag to the bottom of an y-axis to a ggplot2 plot. This should be doable by retrieving the axis grob and adding points to the horizontal line.

Here's a toy example:

library(ggplot2)

data(airquality)
data <- na.exclude(airquality)
model <- lm(Temp ~ Wind, data)

png(filename = "basic_plot.png", width=500, height=500, type = "cairo", res = 120)
ggplot(data=data, aes(y=Temp, x=Wind)) +
  geom_point() +
  geom_abline(intercept=coef(model)[1],
              slope=coef(model)[2])+
  theme_bw()
dev.off()

basic ggplot

Here's the core idea (sorry the ugliness, Gimp is not the ideal tool for this):

plot with zigzag

asked 10 secs ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 21 مهر 1395 ساعت: 8:50

صفحه بندی