Scatter plot "macro" or "include" for POV?

Scatter plot "macro" or "include" for POV?

Post by Lee » Wed, 15 Nov 2000 04:00:00



I'd like to make a 3d scatter plot of some data I have, essentially a
graph with xyz axes and a sphere at certain <x,y,z> coordinates. This
sounds easy enough, but getting the axis labels and tick marks down
would take some doing. I wonder if any one has written a macro or
include file that would help automate some of this. I'd also be
interested if anyone has similar routines for creating 3d histograms.

Thanks in advance,
Lee

 
 
 

Scatter plot "macro" or "include" for POV?

Post by Chris Hodge » Thu, 16 Nov 2000 09:33:51


I think that's quite a task. I had a go (using some old pascal code) at converting my data to a .gif file and using height_field.  Couldn't get the gif to work properly though.

I'd be very happy to get involved in writing something like this, but I suspect I'm not really up to it.

Chris

 
 
 

Scatter plot "macro" or "include" for POV?

Post by Jeremy Harbinso » Thu, 16 Nov 2000 04:00:00


So far as I know, this has been done. You can output either (or both?)
VRML or POVRay files from Matlab using some downloadable matlab m files
(not in the Mathworks site) and likewise for Maple v5 there is a
freeware  POVRay export tool addon. There are probably more - try
searching, but I'll also try to dig out the URLs (they are at home).
all the best
Jeremy Harbinson

> I'd like to make a 3d scatter plot of some data I have, essentially a
> graph with xyz axes and a sphere at certain <x,y,z> coordinates. This
> sounds easy enough, but getting the axis labels and tick marks down
> would take some doing. I wonder if any one has written a macro or
> include file that would help automate some of this. I'd also be
> interested if anyone has similar routines for creating 3d histograms.

> Thanks in advance,
> Lee

 
 
 

Scatter plot "macro" or "include" for POV?

Post by Jeremy Harbinso » Fri, 17 Nov 2000 04:00:00


For Matlab or Octave data can be plotted in VRML format using VRMLplot.m
(m files are Matlab function files) - this can be obtained from
http://www.dsl.whoi.edu/DSL/sayers/VRMLplot. Any VRML file produced would
then need to be converted to POVRay format; there is such a utility at
http://www.ChemicalGraphics.com/paul/vrml2pov/index.html, and no doubt
many others. If you can use Maple V5 then you can try using POVDISPLAY;
get this from http://cso.ulb.ac.be/cso/povweb/introduction.html. The
latter seems largely for generating nice 3D representations of 3D
functions/surfaces, so it may be less useful to you. There is also a VRML
kit available for Python.
good luck,
Jeremy Harbinson

> I'd like to make a 3d scatter plot of some data I have, essentially a
> graph with xyz axes and a sphere at certain <x,y,z> coordinates. This
> sounds easy enough, but getting the axis labels and tick marks down
> would take some doing. I wonder if any one has written a macro or
> include file that would help automate some of this. I'd also be
> interested if anyone has similar routines for creating 3d histograms.

> Thanks in advance,
> Lee

 
 
 

Scatter plot "macro" or "include" for POV?

Post by Chris Hodge » Fri, 17 Nov 2000 04:00:00


I've been working on something like this off and on for a while now, but the C compiler's on a strop, so I'm rewriting the lot in turbo pascal.  I'll post it on the web if and when I finish it.  Watch this space (but not too hard - lucky if it'll be up in time for Xmas).

It might do a bit more than you were looking for.  I'll keep the rest under my hat for now.

Chris

 
 
 

Scatter plot "macro" or "include" for POV?

Post by Chris Colefa » Sat, 18 Nov 2000 13:47:24



> I'd like to make a 3d scatter plot of some data I have, essentially a
> graph with xyz axes and a sphere at certain <x,y,z> coordinates. This
> sounds easy enough, but getting the axis labels and tick marks down
> would take some doing. I wonder if any one has written a macro or
> include file that would help automate some of this. I'd also be
> interested if anyone has similar routines for creating 3d histograms.

I don't know of any include files that offer a template like this, although
it seems likely some would be available - if so, Ken Tyler will almost
certainly link to them from http://www.povray.org/links

However, it shouldn't be difficult to create this sort of thing yourself.
One problem might arise if you want grid lines - whether you use cylinders
or textures, the thickness of the lines in the final image will depend on
the resolution you're rendering at.  Personally, I prefer to use a checker
pattern for POV-Ray graphs, which eliminates the scaling problem.

For a 3D scatter plot, you could start with three flat boxes as a
background, with the origin at the lower-left-front corner (respective to
the camera).  To this you could add unit labels using text objects.  To make
the code flexible, use variables to control various aspects of the code:

camera {location <15, 15, -15> look_at <5, 3, 4> angle 45}
light_source {<500, 500, -500> rgb 1.3}
background {rgb 0.5}

#declare GraphSize = <10, 6, 8>;
#declare GridTexture = texture {
   pigment {checker rgb 0.3, rgb 0.7}
   finish {ambient 0.5 diffuse 0.5}
   scale <1, 0.5, 1>}
#declare LabelFreq = <2, 1, 1>;
#declare LabelDecimals = 0;
#declare LabelFont = "Arial"
#declare LabelFontScale = 0.5;
#declare LabelTexture = texture {
   pigment {rgb <1, 0, 0>}}

// Graph grid
   union {
      box {<0, 0, 0>, GraphSize*<1, 0, 1>}
      box {<0, 0, 0>, GraphSize*<0, 1, 1>}
      box {GraphSize*<0, 0, 1>, GraphSize}
      texture {GridTexture}
      }

// Graph labels
   union {
      #declare C = 0; #while (C <= GraphSize.x)
         text {ttf LabelFont, str(C, 0, LabelDecimals), 0.1, 0
            translate <-0.4, -1, 0.05> rotate x*90
            scale LabelFontScale translate x*C}
      #declare C = C + LabelFreq.x; #end

      #declare C = LabelFreq.y; #while (C <= GraphSize.y)
         text {ttf LabelFont, str(C, 0, LabelDecimals), 0.1, 0
            translate <-0.4, -1, 0.05> rotate <90, 0, -90>
            scale LabelFontScale translate y*C}
      #declare C = C + LabelFreq.y; #end

      #declare C = LabelFreq.z; #while (C <= GraphSize.z)
         text {ttf LabelFont, str(C, 0, LabelDecimals), 0.1, 0
            translate <-0.4, -1, 0.05> rotate <90, -90, 0>
            scale LabelFontScale translate z*C + x*GraphSize}
      #declare C = C + LabelFreq.z; #end

      texture {LabelTexture}
      }

To add data, you can define a macro that also adds "lines" to the graph
grid:

   #macro PlotData (Location, Size, Colour)
      sphere {Location, Size pigment {Colour}}
      union {
         cylinder {Location*<1, 0, 1>, Location, 0.01}
         cylinder {Location*<0, 1, 1>, Location, 0.01}
         cylinder {Location*<1, 1, 0>+z*GraphSize, Location, 0.01}
         pigment {rgb 0 transmit 0.5}
         }
   #end

PlotData (<3, 4, 2>, 0.1, rgb <1, 1, 0>)
PlotData (<8, 5, 4>, 0.2, rgb <0, 1, 1>)
PlotData (<5, 1, 6>, 0.3, rgb <1, 0, 1>)

All of this is, of course, just the beginning.  Thanks to the flexibility of
POV's scripting language and renderer the possibilities are endless... the
hard part is deciding what you want to create!

 
 
 

Scatter plot "macro" or "include" for POV?

Post by Jeremy Harbinso » Sat, 18 Nov 2000 04:00:00


These kind of graphs might just convince my students that the biophysics of
photosynthesis is actually interesting.
And, just think, once-upon-a-time graphs made with Letraset and drawing pens
seemed high-tech and clever, sigh......
all the best,
Jeremy Harbinson


> > I'd like to make a 3d scatter plot of some data I have, essentially a
> > graph with xyz axes and a sphere at certain <x,y,z> coordinates. This
> > sounds easy enough, but getting the axis labels and tick marks down
> > would take some doing. I wonder if any one has written a macro or
> > include file that would help automate some of this. I'd also be
> > interested if anyone has similar routines for creating 3d histograms.

> I don't know of any include files that offer a template like this, although
> it seems likely some would be available - if so, Ken Tyler will almost
> certainly link to them from http://www.povray.org/links

> However, it shouldn't be difficult to create this sort of thing yourself.
> One problem might arise if you want grid lines - whether you use cylinders
> or textures, the thickness of the lines in the final image will depend on
> the resolution you're rendering at.  Personally, I prefer to use a checker
> pattern for POV-Ray graphs, which eliminates the scaling problem.

> For a 3D scatter plot, you could start with three flat boxes as a
> background, with the origin at the lower-left-front corner (respective to
> the camera).  To this you could add unit labels using text objects.  To make
> the code flexible, use variables to control various aspects of the code:

> camera {location <15, 15, -15> look_at <5, 3, 4> angle 45}
> light_source {<500, 500, -500> rgb 1.3}
> background {rgb 0.5}

> #declare GraphSize = <10, 6, 8>;
> #declare GridTexture = texture {
>    pigment {checker rgb 0.3, rgb 0.7}
>    finish {ambient 0.5 diffuse 0.5}
>    scale <1, 0.5, 1>}
> #declare LabelFreq = <2, 1, 1>;
> #declare LabelDecimals = 0;
> #declare LabelFont = "Arial"
> #declare LabelFontScale = 0.5;
> #declare LabelTexture = texture {
>    pigment {rgb <1, 0, 0>}}

> // Graph grid
>    union {
>       box {<0, 0, 0>, GraphSize*<1, 0, 1>}
>       box {<0, 0, 0>, GraphSize*<0, 1, 1>}
>       box {GraphSize*<0, 0, 1>, GraphSize}
>       texture {GridTexture}
>       }

> // Graph labels
>    union {
>       #declare C = 0; #while (C <= GraphSize.x)
>          text {ttf LabelFont, str(C, 0, LabelDecimals), 0.1, 0
>             translate <-0.4, -1, 0.05> rotate x*90
>             scale LabelFontScale translate x*C}
>       #declare C = C + LabelFreq.x; #end

>       #declare C = LabelFreq.y; #while (C <= GraphSize.y)
>          text {ttf LabelFont, str(C, 0, LabelDecimals), 0.1, 0
>             translate <-0.4, -1, 0.05> rotate <90, 0, -90>
>             scale LabelFontScale translate y*C}
>       #declare C = C + LabelFreq.y; #end

>       #declare C = LabelFreq.z; #while (C <= GraphSize.z)
>          text {ttf LabelFont, str(C, 0, LabelDecimals), 0.1, 0
>             translate <-0.4, -1, 0.05> rotate <90, -90, 0>
>             scale LabelFontScale translate z*C + x*GraphSize}
>       #declare C = C + LabelFreq.z; #end

>       texture {LabelTexture}
>       }

> To add data, you can define a macro that also adds "lines" to the graph
> grid:

>    #macro PlotData (Location, Size, Colour)
>       sphere {Location, Size pigment {Colour}}
>       union {
>          cylinder {Location*<1, 0, 1>, Location, 0.01}
>          cylinder {Location*<0, 1, 1>, Location, 0.01}
>          cylinder {Location*<1, 1, 0>+z*GraphSize, Location, 0.01}
>          pigment {rgb 0 transmit 0.5}
>          }
>    #end

> PlotData (<3, 4, 2>, 0.1, rgb <1, 1, 0>)
> PlotData (<8, 5, 4>, 0.2, rgb <0, 1, 1>)
> PlotData (<5, 1, 6>, 0.3, rgb <1, 0, 1>)

> All of this is, of course, just the beginning.  Thanks to the flexibility of
> POV's scripting language and renderer the possibilities are endless... the
> hard part is deciding what you want to create!

 
 
 

1. ****"""""BUG IN PROGRAM"""*****

Does anyone have a problem using PhotoShop 3.  I have alien skin filters
and Kai's Power Tools and yet if I use the spheroid designer in Kai's Power
Tools and then try to add a drop shadow to it using alien skin, PhotoShop
crashes.  Has anyone got a solution to this problem.  It's really bugging
me (pun not intentional).

Yours Pete

2. Available: OpenGL programmers

3. """"LOOKING FOR METRAEYES MODELLER AND TURBO.PXP FOR AN EXCHANGE"""""

4. 3D COMPUTER ANIMATORS WANTED

5. Dss Satellite "HU"&"H"card programming click link

6. HELP:Piping data from Cygnus GCC

7. ***WHICH IS BEST CAPTURE"SNAPPY""AIGOTCHA"?***

8. HELP - "mli"/"mat"

9. "Fur"/"hair" texture

10. popen("gnuplot", "w")

11. plotting "frequency plots"

12. "save as" macro question in PS7