Skip to content
Prev 13420 / 29559 Next

Legend in density plot

Dear list!

I have GPS data for three seasons of roaming livestock and to get an 
idea which areas the animals occupied and the differences between the 
seasons, I am plotting density plots for each season like this:

posi <- readOGR(dsn = "PG:host=127.0.0.1 user=user dbname=mydb 
password=secret, layer = "mylayer")

pposi <- ppp(posi at coords[,1], 
posi at coords[,2],xrange=c(posi at bbox[1,1],posi at bbox[1,2]), 
yrange=c(posi at bbox[2,1],posi at bbox[2,2]))

densi <- density(pposi, bw = "nrd0", adjust = 0.1, kernel = 
c("epanechnikov"), edge = TRUE, diggle=TRUE)

plot(densi, col = mypalette)

so far, so good:

BUT as there where differences between the years, the legend which is 
plotted on the left of each map shows different values/ has different 
ranges, which is bad for a comparision, so my question is:

How can I change the range and the ticks in the legend of a density map?

I hope I made my point clear - Thank you in advance!

regards,
Albin