Hi there,
i'm a newbie at posting on this forum. so hopefully my question is clear/ simple.
i am trying to do a simple logged ggplot, showing the change in tree and shrub density over time (site age). the tree species are split into native / exotic.
i have also downloaded the "viridis" package - to enable a type of coloration to the legend+line+points+confidence interval fill.
this is the code i have used:
attach(data.df4)
base <- ggplot(data.df4, aes(age, total_trees, colour=status))
base + theme_classic(base_size = 10, base_family = "Bell MT") +
scale_y_log10() +
geom_point(aes(color = status)) +
geom_smooth(aes(color=status, fill=status), method = "lm",se=TRUE) +
scale_color_viridis(discrete = TRUE, option = "D")+
scale_fill_viridis(discrete = TRUE, option = "D") +
labs(title = "changes in planted canopy and subcanopy tree and shrub density over time", x="planting age", y="density (plot-level)")
The problem is, when i do this i get two sepperate legends. which i don't want. i can't figure out how to keep the viridis legend, and remove the other legend.
what i want to achieve is shown at this website under " Viridis color palettes": https://www.datanovia.com/en/blog/ggplot-colors-best-tricks-you-will-love/
what i am producing:
Sample of Data table:
Site - Status - Age - Total Trees
site1 - native -- 15 ---- 10
site1 - exotic -- 15 ----- 2
site2 - native -- 20 ----- 35
site2 - exotic -- 20 ----- 4