Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><code>jet.colors</code> is the R-answer to one of hte Matlab color palettes:</p> <pre><code>points = seq(-2, 0, length=20) #create a grid XY = expand.grid(X=points,Y=-points) # A z-function Zf &lt;- function(X,Y){ 2./exp((X-.5)^2+Y^2)-2./exp((X+.5)^2+Y^2); } # populate a surface Z &lt;- Zf(XY$X, XY$Y) zlim &lt;- range(Z) zlen &lt;- zlim[2] - zlim[1] + 1 jet.colors &lt;- # function from grDevices package colorRampPalette(c("#00007F", "blue", "#007FFF", "cyan", "#7FFF7F", "yellow", "#FF7F00", "red", "#7F0000")) colorzjet &lt;- jet.colors(100) # 100 separate color require(rgl) open3d() rgl.surface(x=points, y=matrix(Z,20), coords=c(1,3,2),z=-points, color=colorzjet[ findInterval(Z, seq(min(Z), max(Z), length=100))] ) axes3d() rgl.snapshot("copyMatlabstyle.png") </code></pre> <p><img src="https://i.stack.imgur.com/sEHQ7.png" alt="CopyMatlab.style.png&quot;"></p> <p>I will admit that getting the colors to line up with the "Z-axis" (which is actually the rgl y-axis) seemed very unintuitive. If you want the shiny, specular effect that Matlab delivers you can play with the angle of illumination.</p> <p><img src="https://i.stack.imgur.com/gAfyF.png" alt="enter image description here"></p> <p>You can also add or remove lighting:</p> <pre><code>clear3d(type = "lights") light3d(theta=0, phi=0) light3d(theta=0, phi=0) # twice as much light. </code></pre> <p>After: </p> <pre><code> grid3d("x") grid3d("y") grid3d("z") rgl.snapshot("copyMatlabstyle3.png") </code></pre> <p><img src="https://i.stack.imgur.com/UuJlo.png" alt="enter image description here"></p> <p>You could have put the y-grid "behind" the surface with:</p> <pre><code>grid3d("y+") </code></pre> <p>Similar tweaks to the <code>axes3d</code> or <code>axis3d</code> calls could move the location of the scales.</p> <p><strike>For further examples, look at <a href="http://rgm3.lab.nig.ac.jp/RGM/R_image_list" rel="nofollow noreferrer">http://rgm3.lab.nig.ac.jp/RGM/R_image_list</a> and search for 'plot3d' which brings up examples of the <code>R2BayesX::plot3d</code> function,</strike> Look at Karline Soetaert's plot3D package vignette, <a href="http://www.google.com/url?sa=t&amp;rct=j&amp;q=&amp;esrc=s&amp;source=web&amp;cd=1&amp;cad=rja&amp;ved=0CCwQFjAA&amp;url=http://cran.r-project.org/web/packages/plot3D/vignettes/volcano.pdf&amp;ei=wDGqUtmlOsHgoASsxYKoBg&amp;usg=AFQjCNEMlvmzmG9QwD0PpyY3eWjdYcpUpQ&amp;sig2=FZ0r1FWTkKjnbPxG0Drusw" rel="nofollow noreferrer">"50 ways to plot a volcano"</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload