I am trying to make a tornado plot (a.k.a. sensitivity graph) in R. The goal is to visualize the effect of a 10% increase and 10% decrease in some variables.
So far I have gotten this result
This is the code I am using:
# Tornado plot
data <- matrix(c(-0.02,0.02,-0.01,0.01,-0.03,0.02,-0.01,0.04), ncol = 4)
rownames(data) <- c('+10%','-10%') # Amount of change in variables
colnames(data) <- c('V_bar', 'alpha', 'rho','xi') # Names of variables
x <- seq(-0.04,0.04, length=10) # For plotting '%' on x-axis
barplot(data, horiz = T, las=1, xlim = c(-0.04,0.04), xaxt='n', ylab = '',
beside=T, col=c('springgreen','indianred2'))
axis(1, at=pretty(x), lab=paste0(pretty(x) * 100," %"), las=TRUE)
I have two final goals I want to achieve:
Getting the bars aligned for each variable (not juxaposed as they are now). In other words, the green and red side of each variable bar should meet at the center, giving a total of four bars.
Paste mathematical characters (instead of the text) on the y-axis. The "V_bar" column should be a V with a bar on top.
Edit: I have posted a separate question for the mathematical characters: Barplot: Greek letters on y axis in R