[R] need help with contourplot figure

David Winsemius dwinsemius at comcast.net
Sat Oct 1 03:54:22 CEST 2011


On Sep 30, 2011, at 2:10 PM, Mike Gibson wrote:

>
> I can't figure out how to add tick marks on both my X and Y axis.   
> For example, my X axis ranges from 0 to 1 and there are both a tick  
> mark and a number label at the X-axis values of 0.2,0.4,0.6. and  
> 0.8.  I want to add tick marks to the figure at every 0.1 value.   
> This will help a viewer determine the values on the x axis.
>
>
> I included all of my code.

But no data. So the only testing was done on help page example.

> I apologize but it is very long.  I am created a contourplot figure  
> that will be a jpg.  I also included my notes after the # sign so  
> you can see what I am doing.  Any help would be greatly appreciated.
>
>

The usual way to modify the default features and locations of ticks  
inside lattice plots is with arguments presented as "scale" values. As  
an example to the help(contourplot) example I added:

    scale=list(x=list(at=seq(4,20, by=5))),

  ... and instead of ticks at 5,10,15, 20, I get them at 4,9,14,19

?xyplot

-- 
David.

> jpeg(file="C:/Documents and Settings/Michael/My Documents/Mike/ 
> amberjack/Reefs_Model/YPRlevel.jpg", width=8,height=8, unit="in",  
> res=300) #location of file and size
> x<-contourplot(YPR~F*Length, data=yprplot2,  
> at 
> = 
> c 
> (2.0,3.0,4.0,5.0,5.5,6.0,6.25,6.5,6.75,7.0,7.12,7.25,7.35,7.45,7.5),  
> ylim=c(25,40), xlim=c(0,1),xlab = "Fishing Mortality Rate", ylab =  
> "Minimum Size (inches)",
> panel=function(...){      #This step adds the point for the current  
> YPR value, ... means to leave the function open to bring in other  
> functions
>    panel.levelplot(...)
>    grid.points(0.609,30,pch=8)   #pch is the point character where  
> 19 is a closed circle
>    grid.points(0.333,30,pch=8)   #pch is the point character where  
> 19 is a closed circle
>    grid.points(eumetric$F, eumetric 
> $Length,pch=18,gp=gpar(col="black", cex=.9))})  #add the eumetric  
> line and make them points
> #now add the text for the current ypr location
> print(x)  #this brings up the figure I already made
> grid.text('Fcurrent',0.62,0.35,gp=gpar(col="black", cex=1)) #0.42  
> and 0.40 is the location of the text on the figure
> grid.text('Fmsy',0.38,0.35,gp=gpar(col="black", cex=1)) #0.42 and  
> 0.40 is the location of the text on the figure
> dev.off()    #it won't send the pdf until this is added.  It turns  
> off the pdf function 		 	   		
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list