[R] Is it possible to create color ramp legend in spplot for discontinuous data ?
istazahn at gmail.com
Sun Jan 20 03:38:06 CET 2013
I'm going to ask you the same thing you were asked when you posted
this question on the r-sig-Geo list: What is data1? Please give us the
output of dput(data1), or make another example that we can reproduce.
On Sat, Jan 19, 2013 at 7:16 AM, Jd Devkota <janesh.devkota at gmail.com> wrote:
> 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")
> p1 <-
> 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
> Thank you so much.
> [[alternative HTML version deleted]]
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help