Basic Spider Plot


We will here use the ggplot2 package and the dataset created in the Data & Functions page.

# Libraries
library(tidyverse)
library(ggplot2)
spider_plot = ggplot(data1) +
    #build the basic graph
    geom_point(aes(x=week, y=changebsl, group=ID, colour=RECIST)) +
    geom_line(aes(x=week, y=changebsl, group=ID, colour=RECIST)) +
    #color
    scale_color_manual(values=c("#1d4f91", "#FF9800", "#228848", '#AE2573', '#D14124')) +
    #axis and title
    labs(x = "Time",
         y = "Change from Baseline (%)",
         title = "Spider Plot",
         shape = " ",
         color = " ") +
    theme_minimal()+
    theme_bw()+
    #font size and background
    guides(fill=guide_legend(title=" "))+
    theme(panel.grid.minor = element_blank(),
          panel.grid.major = element_blank(),
          panel.background = element_blank(),
          plot.title = element_text(hjust = 0.5, size = 16),
          axis.text=element_text(size=16),
          axis.title=element_text(size=16),
          legend.text = element_text(size=16))

spider_plot




Contact

This document is a work of the statistics team in the Biostatistics and Medical Information Department at Saint-Louis Hospital in Paris (SBIM).
Based on The R Graph Gallery by Yan Holtz.