Hello All,

I have a discontinuous dataset and I used spplot to plot the points.

I was wondering whether it is possible to show the legend of the plot as
color ramp. I saw that on continuous data. If anyone could tell me that
would be great.

Another thing I would like to know is how can we create the horizontal
legend. By default, the legend is vertical.

I was able to shift the legend inside the plot but not horizontal. Some of
the code I used is as follows:

##Polygon as major plot and contour as layout
## Put north icon on the map
l2 = list("SpatialPolygonsRescale", layout.north.arrow(), offset =
c(439000,3368000), scale = 4000)
l3 = list("SpatialPolygonsRescale", layout.scale.bar(), offset =
c(460000,3352000), scale = 5000, fill=c("transparent","black"))
l4 = list("sp.text",c(460000,3351500),"0")
l5 = list("sp.text",c(465000,3351500),"100 m")
cuts=c(0,5,10,15,20,25,30,35,37,39,40)

p1 <-
spplot(data1,sp.layout=list(list("sp.polygons",hello),l2,l3,l4,l5),axes=T,xlab="Eastings",cuts=cuts,
ylab="Northings",lwd=2,cex=1.2,col.regions = rainbow(100, start = 3/15, end
= 1))

# Legend in Spplot
names(p1$legend) <- "inside"
p1$legend$inside$x <- 0.15
p1$legend$inside$y <- 0.9
plot(p1)

Thank you so much.

Janesh

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to