How do I adjust the spacing between individual labels in a legend in R?
I am trying to adjust the spacing between individual labels in the legend so that I can see all 9 labels, but unfortunately I have not been successful. Here is my code for creating frames
# raw counts
boxplot(log2(counts+1), col = col[as.integer(group)], las = 2,
main = "Raw counts distribution", ylab = expression(log[2] ~ (raw ~ count + 1)))
legend("top", levels(group), fill=col[1:nlevels(group)], horiz=TRUE)
# norm counts
boxplot(log2(norm.counts+1), col = col[as.integer(group)], las = 2,
main = "Normalized counts distribution", ylab = expression(log[2] ~ (norm ~ count + 1)))
legend("top", levels(group), fill=col[1:nlevels(group)], horiz=TRUE)
I even tried to include a function text.width
like this
# raw counts
boxplot(log2(counts+1), col = col[as.integer(group)], las = 2,
main = "Raw counts distribution", ylab = expression(log[2] ~ (raw ~ count + 1)))
legend("top", levels(group), fill=col[1:nlevels(group)], text.width = 0.2, horiz=TRUE)
# norm counts
boxplot(log2(norm.counts+1), col = col[as.integer(group)], las = 2,
main = "Normalized counts distribution", ylab = expression(log[2] ~ (norm ~ count + 1)))
legend("top", levels(group), fill=col[1:nlevels(group)], text.width = 0.2, horiz=TRUE)
but it got worse.
How do I adjust the spaces to see all the labels?
+3
source to share
No one has answered this question yet
Check out similar questions: