This is rather embarrassing, but the solution was fairly simple,  
thanks to Uwe and Martin for a GREAT PACKAGE.  Anyhow, hope somebody  
else gets inspired at the very least

Jon




> library(scatterplot3d)
>
> # get a coastline
> library(maps)
> library(mapdata)
> coast<-map('worldHires', c('usa','canada'),xlim=c(-72,-67),  
> ylim=c(40,45),fill=TRUE, col='gray')
> # note: substitute a simple polygon if you don't have maps and mapdata
> # coast<-list()
> # coast$x<-c(-70.5,-70.5,-70,-70)
> # coast$y<-c(41.2,43,43,41.2)
>
> lat<-c(41,41.5,42,42.5,43)
> long<-c(-71,-69.5,-70,-70.2,-69.8)
> weight<-c(80,20,30,30,10)

> p3d<-scatterplot3d(long, lat, weight, angle=75, type='h', box=FALSE,  
> asp=1, grid=FALSE)
> p3d$points3d(coast$x,coast$y,rep(0, length(coast$x)), type='l',  
> col='gray')

#####
v<-p3d$xyz.convert(coast$x, coast$y, rep(0,length(coast$x)))
polygon(v$x, v$y,col='grey')
#####

> # Now how to fill this polygon...?
>


Begin forwarded message:

> From: Jon Loehrke <[EMAIL PROTECTED]>
> Date: April 11, 2008 3:01:03 PM EDT
> To: r-help@r-project.org
> Subject: polygons on scatterplot3d
>
> Does anyone have any experience plotting complex polygons on a  
> scatterplot3d display?  I would like to present some spatially  
> binned data in a 3-d type plot with background polygons (i.e.. a  
> filled coastline map).  I can get the coastline onto the plot window  
> as a line type but cannot figure out how to fill the shape.  I'm  
> certain it may be possible but might require a bit of digging into  
> the scatterplot3d code and rotational method.
>
> Any and all help or suggestions appreciated.
>
> EX.
>
> library(scatterplot3d)
>
> # get a coastline
> library(maps)
> library(mapdata)
> coast<-map('worldHires', c('usa','canada'),xlim=c(-72,-67),  
> ylim=c(40,45),fill=TRUE, col='gray')
> # note: substitute a simple polygon if you don't have maps and mapdata
> # coast<-list()
> # coast$x<-c(-70.5,-70.5,-70,-70)
> # coast$y<-c(41.2,43,43,41.2)
>
> lat<-c(41,41.5,42,42.5,43)
> long<-c(-71,-69.5,-70,-70.2,-69.8)
> weight<-c(80,20,30,30,10)
>
> p3d<-scatterplot3d(long, lat, weight, angle=75, type='h', box=FALSE,  
> asp=1, grid=FALSE)
> p3d$points3d(coast$x,coast$y,rep(0, length(coast$x)), type='l',  
> col='gray')
> # Now how to fill this polygon...?
>
> Cheers,
>
> Jon
> Mac OS 10.5
> R 2.6.2
> Intelligence Finite
>
>
>
> Jon Loehrke
> Graduate Research Assistant
> Department of Fisheries Oceanography
> School for Marine Science and Technology
> University of Massachusetts
> 200 Mill Road, Suite 325
> Fairhaven, MA 02719
> [EMAIL PROTECTED]
> 508-910-6393
>

Jon Loehrke
Graduate Research Assistant
Department of Fisheries Oceanography
School for Marine Science and Technology
University of Massachusetts
200 Mill Road, Suite 325
Fairhaven, MA 02719
[EMAIL PROTECTED]
508-910-6393


        [[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