Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6977765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:40:03+00:00 2026-05-27T17:40:03+00:00

I’ve been working on a rather complicated chart in R. I have a wireframe

  • 0

I’ve been working on a rather complicated chart in R. I have a wireframe with a surface and points distributed in X,Y,Z space all over (e.g. under the surface and over it).

The problem is that the points that plot don’t “look” like they are underneath the surface.

I am trying to figure out how best to visualize this chart to make the points look under the surface. Some sample code for the wireframe & cloud come from here: R-List Posting

The code in an example:

library(lattice)
surf <-
expand.grid(x = seq(-pi, pi, length = 50),
            y = seq(-pi, pi, length = 50))

surf$z <-
with(surf, {
    d <- 3 * sqrt(x^2 + y^2)
    exp(-0.02 * d^2) * sin(d)
})

g <- surf

pts <-   data.frame(x =rbind(2,2,2), y=rbind(-2,-2,-2), z=rbind(.5,0,-.5))

wireframe(z ~ x * y, g, aspect = c(1, .5),
      drape=TRUE,
      scales = list(arrows = FALSE),
      pts = pts,
      panel.3d.wireframe =
      function(x, y, z,
               xlim, ylim, zlim,
               xlim.scaled, ylim.scaled, zlim.scaled,
               pts,
               ...) {
          panel.3dwire(x = x, y = y, z = z,
                       xlim = xlim,
                       ylim = ylim,
                       zlim = zlim,
                       xlim.scaled = xlim.scaled,
                       ylim.scaled = ylim.scaled,
                       zlim.scaled = zlim.scaled,
                       ...)
          xx <-
              xlim.scaled[1] + diff(xlim.scaled) *
                  (pts$x - xlim[1]) / diff(xlim)
          yy <-
              ylim.scaled[1] + diff(ylim.scaled) *
                  (pts$y - ylim[1]) / diff(ylim)
          zz <-
              zlim.scaled[1] + diff(zlim.scaled) *
                  (pts$z - zlim[1]) / diff(zlim)
          panel.3dscatter(x = xx,
                          y = yy,
                          z = zz,
                          xlim = xlim,
                          ylim = ylim,
                          zlim = zlim,
                          xlim.scaled = xlim.scaled,
                          ylim.scaled = ylim.scaled,
                          zlim.scaled = zlim.scaled,
                          ...)
      })

Screen Capture

Looking at my example, the points in pts are in actually in vertical line where X,Y =(2,-2) and the z goes from .5 to -.5.

However, to my eye the third point doesn’t look like it is under the surface, to it looks like it is at coordinates(2,-3,0).

Is this just my eye mis-interpreting this ?

Does anyone have a suggestion on how to make my points look more “3D” ? Perhaps muting the color of the point to make it look “under the surface” by using some sort of transparency on the surface ?

I tried making the colors of the points different (red for over the surface, blue for under the surface) but that does not really help the graph much.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:40:04+00:00Added an answer on May 27, 2026 at 5:40 pm

    This might get you started:

    library(emdbook)
    sfun <- function(x,y) {
      d <- 3 * sqrt(x^2 + y^2)
      exp(-0.02 * d^2) * sin(d)
    }
    
    cc <- curve3d(sfun(x,y),xlim=c(-pi,pi),ylim=c(-pi,pi),n=c(50,50),
            sys3d="rgl")
    
    colvec <- colorRampPalette(c("pink","white","lightblue"))(100)
    with(cc,persp3d(x,y,z,col=colvec[cut(z,100)],alpha=0.5))
    pts <-   data.frame(x=c(2,2,2), y=c(-2,-2,-2), z=c(.5,0,-.5))
    with(pts,spheres3d(x,y,z,col="blue",radius=0.1))
    rgl.snapshot("rgltmp1.png")
    

    enter image description here

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.