Adding zig-zag to y-axis between zero and first tick to a ggplot

ساخت وبلاگ

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

back soft...
ما را در سایت back soft دنبال می کنید

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