[R] latticeExtra tileplot question - tiles are not all the same size, need help.

Ryan Flaherty ryan1.flaherty at gmail.com
Wed Dec 5 00:01:00 CET 2012


Hello,

I have been creating many tileplots to try and illustrate the relative
abundance of fish through space and time. My issue is that the tiles that
border the plot are smaller than those in the center of the plot. In the
example I've provided the effect is pretty minor (I'm hoping this will be an
adequate example as I had the code already created/data uploaded). However,
I have other plots that have fewer space-time strata (fewer tiles) and the
effect is very noticeable. 

Code:
##You will need to load the following packages: latticeExtra, gridExtra and
RCurl
#Upload data


cwtb_csv<-getURL("https://docs.google.com/spreadsheet/pub?key=0AjzYZNH9Dw9qd
Fc5c1FXZ19uYXE3U1QwU1MxVkR4dGc&single=true&gid=0&output=csv",ssl.verifypeer
= FALSE)
cwtb<-read.csv(textConnection(cwtb_csv),header=T)
gsi_csv<-getURL("https://docs.google.com/spreadsheet/pub?key=0AjzYZNH9Dw9qdD
NTN2djUEl3UVdhZ0t4ZXZrdHpPc2c&output=csv",ssl.verifypeer=FALSE)
gsi_s<-read.csv(textConnection(gsi_csv),header=T)

##Custom color ramp...I didn't like the ones that are provided in the
package, this is similar to jet colors in matlab
jet.colors <-
  colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan",
                     "#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000"))

#Tileplots comparing how CWT recoveries from brood year 1974 -1977 and GSI
data 
#from 2010 - 2011 represent the relative abundance of Rogue river chinook
salmon through space and time

R_g_s<-tileplot(Rogue~month_num*-area_num,gsi_s,col.regions=jet.colors(256),
	scales=list(x=list(at=5:9, labels=c('May'
,'June','July','August','September')), 
      	 y=list(at=(-1):-8,labels=c('T','N','C','B','KC','FB','SF','MO'))),
	main = list(label="Relative abundance of Rogue River stock (WCGSI
2010-2011)",cex=0.75) ,
	xlab= "Month",
	ylab= "Management Area",
	border = "black",
	panel = function(...){
	panel.fill("black")
	panel.voronoi(...)
	})

R_c_b<-tileplot(Rogue~month_num*-area_num,cwtb,col.regions=jet.colors(256),
	scales=list(x=list(at=5:9, labels=c('May'
,'June','July','August','September')), 
      y=list(at=(-1):-8,labels=c('T','N','C','B','KC','FB','SF','MO'))),
	main = list(label="Relative abundance of Rogue River stock (CWT 1977
- 1983)",cex=0.75) ,
	xlab= "Month",
	ylab= "Management Area",
	border = "black",
	panel = function(...){
	panel.fill("black")
	panel.voronoi(...)
	})

#plot the two tileplots side by side

grid.arrange(R_c_b,R_g_s,ncol=2)

Thank you in advance for any advice regarding how to remedy this issue.

Regards,


Ryan



More information about the R-help mailing list