views:

815

answers:

5

I'm trying to make a visualization that looks like this http://www.gradient-da.com/img/temperature%20surface%20plot%20470x406.JPG.

The idea is to have a 3D surface plot overlapping a 2d representation of a surface.

I can build arbitrary surfaces/polygon shapes (as in http://addictedtor.free.fr/graphiques/graphcode.php?graph=135 ) and I can make the respective 2D plot. What I don't seem to be able to figure out is the way to put them together in a nice way (like the one shown in the jpg above).

I've tried googling for the answer, but I wasn't able to find anything similar done in R. Any help would be greatly appreciated!

EDIT: The 2D portion is not a projection of the 2D one. I chose this specific picture to illustrate this. For example

  1. Here the 2D portion is the image of the circuit and on the 3D portion is the temperature).
  2. In 2D you can have the map of a city and in 3D the traffic
  3. etc...

Best,

Bruno

A: 

It looks like the 2D plot is a layout of a microelectronic circuit, albeit with some detail skipped, and the 3D plot is perhaps a thermal plot of the same circuit.

I don't know enough about R's capabilities, but I imagine it would be easier to generate the two plots separately with R from the same dataset which represents the layout information (but with and without the thermal data) and then combine them with a graphics manipulation program.

pavium
+2  A: 

I will give a theoretical Idea,

In the same 3D plot, select a plane perpendicular to the 3D surface (just below the 3D-surface) and project all the values to it. Instead of 2D & 3D plot, you will use only a 3D plot, which also plots your surface.

HTH

Alphaneo
Sorry if I was not clear. The 2D portion is *not* a projection of the 2D one. I chose this specific picture to illustrate that (on the 2D you have the image of the circuit and on the 3D you have temperature).
bgoncalves
Not a problem. You can draw your 2D plot in a plane of the 3D plot.
Alphaneo
A: 

No help in R, but you can do something similar in ROOT as seen in this image:

histogram plotted with SURF3 option

taken from the THistPainter class documentation.

The code is open source and could be examined if wanted for reimplementation.

dmckee
A: 

Maybe you should try to make an opengl texture out of your 2d picture and map it on a 3d polygon to be included in your scenegraph?

Don't really understand if you wish to do it with R specifically, so maybe diving in opengl is a too low level for you. In case you'd be ready for that, you may reuse a simple java library that simplify plotting 3d surface: http://code.google.com/p/jzy3d

Hope that helps, Martin

Martin
A: 

What you're looking for is called a texture map -- and if it's not provided in the R graphics package, you may be able to do it "by hand". The suggestion below may not be fast or convenient (or even helpful, as I'm not really familiar with R), but it may actually work...

Since you know you can draw a 3D surface plot with specified colors, you can try drawing a flat 3D surface using the colors of your image.

If R also lacks methods for extracting its data from image formats, there is an image format called PPM (standing for Portable PixMap), one variant of which is basically space-separated decimal numbers. After converting your image to this format (using Photoshop, say, or some dedicated image conversion program), it should be relatively easy to input into R.

comingstorm