1

I have a shapefile with various attributes. I want to plot the shapefile using `spplot'.

I first read the shapefile

A <- readOGR('myshapefile.shp') 

I am using the following command:

p <- spplot(A, c('lulc', 'lulc_2', 'lulc_3', 
                 'lulc_4', 'lulc_5', 'lulc_6', 'lulc_7'), 
            col.regions=myColors, 
            col='transparent', 
            names.attr = c(1998, 1999, 2002, 2003, 2009, 2014, 2017))

Surprisingly, the map order is from bottom to top and left to right in 3 rows.

I want them to appear from top to bottom and left to right order i.e. 1998 should appear first and 2017 should appear last.

1 Answer 1

0

Add as.table=TRUE:

‘as.table’ logical; start drawing panels upper-left instead of lower-left

See also ?xyplot

‘as.table’: A logical flag that controls the order in which panels should be displayed: if ‘FALSE’ (the default), panels are drawn left to right, bottom to top (as in a graph); if ‘TRUE’, left to right, top to bottom (as in a table).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.