We will here use the ggplot2
package and the dataset
created in the Data & Functions
page.
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))
# Add Indicator Variable
data1$lesion <- as.factor(data1$lesion)
spider_plot +
geom_point(data=data1, aes(x=week, y=changebsl, shape=lesion), size = 3) +
scale_shape_manual(values=c("1" = 8, "0" = NA), labels = c("1" = paste("Indicator", "\n", "Variable"), "0" = " "))
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.