Code/10_pa_plot_code.R

#davidson.theme
#feb2020
#function for theme choices
theme_manuscript_v1 <- function(base_size = 18,
                      base_family = "Times",
                      base_line_size = base_size / 170,
                      base_rect_size = base_size / 300) {
    theme_bw(
        base_size = base_size,
        base_family = base_family,
        base_line_size = base_line_size
      ) %+replace%
          theme(
            plot.title = element_text(hjust = 0, size=24, family = "Times", color="black", margin = margin(t = 10, b = 10)),
            plot.subtitle=element_text(size=16, face="italic", color="black"),

            #legend
            legend.position = "right",
            # legend.background = element_rect(fill="white", size=1),
            legend.key.size=unit(1,"cm"),
            legend.text = element_text(colour = "black", size =16, family = "Times"),
            legend.title = element_text(colour = "black", size =16, family = "Times"),
            legend.spacing.x = unit(0.1, 'cm'),
            legend.spacing.y = unit(0.1, 'cm'),
            # legend.box.spacing = unit(0, 'cm'),

            panel.grid.major = element_blank(),
            panel.grid.minor = element_blank(),
            # panel.spacing = unit(2, "lines"),
            panel.border = element_blank(),

            axis.title.y = element_text(colour = "black",size =20, family = "Times", angle = 90),

            axis.title.x = element_text(colour = "black", size =20, family = "Times"),
            axis.text.y=element_text(colour = "black",size = 20, family = "Times"),
            axis.text.x = element_text(colour = "black", size =20, family = "Times"),

            axis.line.y = element_blank(),
            axis.line.x = element_blank(),
            axis.ticks.x = element_blank(),
            axis.ticks.y = element_blank(),

            strip.text = element_text(face="bold",colour = "black",size =14, family = "Times"),

      complete = TRUE) # end of ggplot theme

  }## finishin function



###Second stage... 2
#two datasets

# low.plot.data
###################
str(low.plot.data)
# low.con1

low.plot.out <- ggplot(data = low.plot.data, aes(y = N, x = Control))+
  # data
  geom_jitter(aes(y = N, x = Control, col = Control, shape = Valley, fill = Conditions),
              stroke = 1.05,
              alpha = 1, size = 4, width = 0.3) +

  geom_point(data = low.con1, aes(y = N, x = Control), shape = "square",col= "grey60",  size = 5) +

  geom_errorbar(data = low.con1, aes(ymin = lcl.low, ymax = ucl.low, width = 0),
                lwd = 1,
                col= "grey60") +
  #labels
  geom_vline(xintercept = 1.5, lty = 2) +
  xlab("Rat removal") +
  ylab(expression(paste("Abundance"," ", "(", italic(N[jt]), ")"))) +
  #Aesthics
  scale_color_manual(name = "Stoat removal",
                     values = c("black", "black")) +

  scale_shape_manual(name = "Ecosystem",
                     values = c(24, 21)) +

  scale_fill_manual(name = "Rat control",
                    values = c("white", "black")) +

  guides(fill = "none",
         col = guide_legend(override.aes = list(
           shape = c(15,0), alpha = 1
         ))) +
  theme_manuscript_v1()# +
davan690/beech-publication-wr documentation built on March 29, 2020, 11:09 a.m.