Tom Collins
Tom Collins

Reputation: 43

r - single labels for multi-plot figures

I'm trying to get my plots to only have labels on the outer edges, like:

enter image description here

but I can't seem to figure out how to get it to work.

I spent some time with this question, but I don't have a great understanding of how par, or plotting in general, really works, so it didn't do me much good.

Anyway, I appended a simplified version of what I have at this point, and I'd really appreciate a hand.

library(popbio)

mat <- matrix2(c(0,0,0,6.13,0.22,0.55,0.05,0,0,0.23,0.79,0.15,0,0,0.16,0.85)) 

ela <- elasticity(mat)
sen <- sensitivity(mat)

par(mfrow = c(1, 3), oma = c(0, 2, 2, 0), mar = c(0, 1, 1, 0), xpd = NA)

image2(mat, mar = c(1,3.5,5,1), col = c("grey"), labels=c(0,0,0,0))
image2(ela, mar = c(1,3.5,5,1), labels=c(0,0,0,0))
image2(sen, mar = c(1,3.5,5,1), labels=c(0,0,0,0))

title(xlab=c("matrix","elasticity","sensitivity"), ylab=c("herb"), outer=TRUE, line=3)

Thanks!

Upvotes: 1

Views: 918

Answers (1)

Zheyuan Li
Zheyuan Li

Reputation: 73385

Is it that much complicated? How about:

par(mfrow = c(1, 3))

image2(mat, mar = c(1,3.5,5,1), col = c("grey"), labels=c(0,0,0,0))
mtext(text = "herb", side = 2, line = 1, las = 2, font = 2)
mtext(text = "matrix", side = 3, line = 0, font = 2)

image2(ela, mar = c(1,3.5,5,1), labels=c(0,0,0,0))
mtext(text = "elas", side = 3, line = 0, font = 2)

image2(sen, mar = c(1,3.5,5,1), labels=c(0,0,0,0))
mtext(text = "sens", side = 3, line = 0, font = 2)

enter image description here

Upvotes: 1

Related Questions