[R] png raster in 3D chart

Cleber Borges k|ebyn @end|ng |rom y@hoo@com@br
Sat Oct 30 23:48:22 CEST 2021


After a lot of testing and reading the manuals, I think I came pretty 
close to what I wanted (code below).

But some Cartesian axes do not appear.

I placed each axis separately and the corners where the raster images 
coincide overlapping the axes. The others have no problems.


Many thanks,

Cleber

######################


library( rgl ); library( grid ); library( jpeg )

Rlogo <- "C:/R/doc/html/logo.jpg"
logo <- readJPEG( Rlogo )

open3d( ); view3d( theta=300, phi=15, zoom=1.2 )

show2d({ par(mar=c(0,0,0,0)); 
grid.raster(logo,0.5,0.5,.80,.80,"center")}, face="xx", rev=1)
show2d({ par(mar=c(0,0,0,0)); 
grid.raster(logo,0.5,0.5,.80,.80,"center")}, face="y-", rev=1)
show2d({ par(mar=c(0,0,0,0)); 
grid.raster(logo,0.5,0.5,.80,.80,"center")}, face="z-")

box3d( floating=NA  )
axes3d( c("x","x-+","x+-","y","y++","z","z--","z++"), tick=FALSE, 
labels=FALSE, expand=1.1 )




Em 30/10/2021 18:34, Duncan Murdoch escreveu:
> On 30/10/2021 3:06 p.m., Cleber Borges via R-help wrote:
>>   library( jpeg );   library( rgl ); library( grid )
>>    logo <- readJPEG( Rlogo )
>>
>>    x <- seq( 0,1,len=10 )
>>
>>    open3d()
>>
>>    plot3d( x, x, x, type='n' )
>>
>>     show2d({
>>     par(mar=c(0,0,0,0))
>>     grid.raster( logo, x=0, width=1, y=0 )
>>     })
>
>
> That's close; the only change I'd make is to the location:
>
> library( jpeg );   library( rgl );  library( grid )
>   logo <- readJPEG( Rlogo )
>
>   x <- seq( 0,1,len=10 )
>
>   open3d()
>
>   plot3d( x, x, x, type='n' )
>
>    show2d({
>    par(mar=c(0,0,0,0))
>    grid.raster( logo, x=0.5, width=1, y=0.5 )
>    })
>
> Duncan Murdoch

-- 
Este email foi escaneado pelo Avast antivírus.
https://www.avast.com/antivirus



More information about the R-help mailing list