Hi,
I have a dataset
Wavelength NCORE_June_29 PILS_June_29 PILS_June_30
<dbl> <dbl> <dbl> <dbl>
1 300 28.4 47.3 82.2
2 350 21.4 21.8 43.6
3 365 19.4 17.5 36.3
4 405 13.9 9.01 21.7
5 430 8.99 6.01 16.1
6 445 8.34 5.14 12.9
7 500 5.93 3.49 6.40
8 532 3.72 2.52 5.01
9 550 2.48 0.807 1.32
The plot from this data could be like
But, in this plot, I want to make the partial dashed line for NCORE_June_29
such as:
half line with a solid line with Wavelength>405
and
half line with a dashed line with Wavelength<=405
)
Or
I would say geom_smooth
lines (solid and dashed).
I am trying via:
wavelength01 %>%
gather(variable, value, NCORE_June_29:PILS_June_30) %>%
ggplot(aes(x = Wavelength, y = value, group = variable, fill = variable)) +
geom_point(aes(color = variable), size=2) +
#geom_line(data=subset(wavelength01, Wavelength<=405), aes(linetype='dotted line')) +
geom_smooth(aes(color = variable), size = 0.5, se = FALSE)+
theme(legend.text=element_text(size=12)) +
theme(legend.title=element_blank()) +
theme(legend.position = c(0.75, 0.7)) +
theme(axis.title = element_text(face="plain",size=14,color="black"),
axis.text=element_text(size=12,face="plain", color="black"),
plot.title = element_text(size=15)) +
scale_color_brewer(palette="Set1")+
ylab(bquote('Abs_Coeff ('*Mm^-1*')')) +
xlab(bquote('Wavelength ('*nm*')')) +
labs(title = "")+ ylim(0,100)
But not able to get the output:
Any help!
Thanks