0

I've got a question regarding legends in a barplot. I don't know why, but whenever I plot a certain dataset it reveals a legend additionally topright, altough I didn't state to do so.

windows()
par(mfrow=c(5,2))
par(oma=c(0,0,2,0))
par(mar=c(3,3,2,0.5))
plot(sens.analysis1,main="Pipe 63569",ylab="", xlab="")
legend("topleft",bty = "n")
title(ylab= "Sobol Indices",line=2)
title(xlab= "Rainfall Characteristics",line=2)
box()

Point is that the legend overlaps with the bars in the plot & I neither find a way to delete the legend, nor how to move it as it is apparently already at the topright corner.

What I'm plotting is the output of a sensitivity analysis, revealing to different values, which are shown in a stacked barplot.

the oupt for sens.analysis1 looks as follows:

Call:
fast99(model = KNN.userdefined, factors = c("D", "V", "PI", "VbP",     "rPL", "CV"), n = 500, q = "qunif", q.arg = rainfall.range)

Model runs: 3000 

Estimations of the indices:
    first order total order
D    0.03000241   0.5003841
V    0.06253180   0.5590381
PI   0.05720192   0.5386929
VbP  0.03993539   0.5198372
rPL  0.04366164   0.5322509
CV   0.03930207   0.5154013

How can I get ridd of a legend that is automatically attached to the plot?? Additional question, does some package functions include default plotting properties, which need further adjustment besides the normal ones? Hints are highly appreciated!!!!

Cheers, Olli

Olli
  • 295
  • 4
  • 14
  • 2
    Please share sample of your `sens.analysis1` data so others can reproduce the problem. See more here [How to make a great R reproducible example?](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) – Tung May 06 '18 at 23:16
  • Hi @Tung, I added the file structure to the question. If you would like to reproduce the problem I'd add the whole script to the question? – Olli May 07 '18 at 07:30
  • Please read the link I posted earlier to learn how to create a reproducible problem – Tung May 07 '18 at 09:03

0 Answers0