Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

ListPlot3D help

24 views
Skip to first unread message

Luca Bonci

unread,
Jan 11, 2000, 3:00:00 AM1/11/00
to
Hello, I need to obtain a 3D plot by using a data file. I could not find

any other way that to use ListPlot3D but it seem that this accepts only
heigths arrays, namely a
rectangular array containing the heights of the surface. In this way I
cannot obtain the right
scales on the x a y axis becasue the x and y data are not considered!

Is there any way to plot a real three-dimensional set of data written as

a set of {x,y,z} points?

Thanks a lot

Luca

Jens-Peer Kuska

unread,
Jan 14, 2000, 3:00:00 AM1/14/00
to
Hi,

if you have a equal spaced rectangular grid of data you can simpliy
remove the x,y pairs and use ListPlot3D[].
If you have a irregular grid you may have a look at
the standard package:

DiscreteMath`ComputationalGeometry`

and the TriangularSurfacePlot[] function.

Hope that helps
Jens

Tobias Oed

unread,
Jan 14, 2000, 3:00:00 AM1/14/00
to
Luca Bonci wrote:
>
> Hello, I need to obtain a 3D plot by using a data file. I could not find
>
> any other way that to use ListPlot3D but it seem that this accepts only
> heigths arrays, namely a
> rectangular array containing the heights of the surface. In this way I
> cannot obtain the right
> scales on the x a y axis becasue the x and y data are not considered!
>
> Is there any way to plot a real three-dimensional set of data written as
>
> a set of {x,y,z} points?
>
> Thanks a lot
>
> Luca

Hi luca, I copy pasted this from one of my pojects. Hope this helps
Tobias.

data=ReadList["!grep -v '#' PI+N.DSG",
{(* W *) Real,(* theta *) Real,(* dsg *) Real,(* err *) Real}
];

(* look at the distribution of the points in W costh space *)

energies=Union[Map[#[[1]]&,data]]

angles=Union[Map[#[[2]]&,data]]

values=Union[Map[#[[3]]&,data]]

(*********************************************************)
(* show distribution of points in energy cos theta range *)

distr=Graphics[{Apply[Sequence,Map[Point[Take[#,2]]&,data]]}]

Show[distr,Axes->True]

(*************************************)
(* Look at cuts with constant energy *)

dataw0=Map[Cases[data,{#,__}]&,energies]

TextPos={Min[angles]+(Max[angles]-Min[angles])/4,Min[values]+(Max[values]-Min[values])/4}

dataw1=Map[{
Text["W="<>ToString[#[[1,1]]],TextPos],
Map[Point[{#[[2]],#[[3]]}]&,#],
Map[Line[{{#[[2]],#[[3]]+#[[4]]/2},{#[[2]],#[[3]]-#[[4]]/2}}]&,#]
}&,dataw0];

opts={
Axes->True,
PlotRange->{{Min[angles],Max[angles]},{Min[values],Max[values]}},
TextStyle->{FontSize->5}
}

dataw2=Map[Graphics[#,opts]&,dataw1];

dataw3=GraphicsArray[Table[Take[dataw2,{i,Min[i+3,Length[dataw2]]}],{i,1,Length[dataw2],4}]
,Frame->True
]

Show[dataw3]

Display["PlotData.W.eps",dataw3,"EPS",{ImageSize->72
#,ImageOffset->{0,72 (#-4)}}&[7]]

Display["PlotData.W.eps",dataw3,"EPS",{ImageSize->72
#,ImageOffset->{0,0}}&[7]]

(************************************)
(* Look at cuts with constant angle *)

dataa0=Map[Cases[data,{_,#,__}]&,angles]

TextPos={Min[energies]+(Max[energies]-Min[energies])/4,Min[values]+(Max[values]-Min[values])/4}

dataa1=Map[{
Text["Cos="<>ToString[#[[1,2]]],TextPos],
Map[Point[{#[[1]],#[[3]]}]&,#],
Map[Line[{{#[[1]],#[[3]]+#[[4]]/2},{#[[1]],#[[3]]-#[[4]]/2}}]&,#]
}&,dataa0];

opts={
Axes->True,
PlotRange->{{Min[energies],Max[energies]},{Min[values],Max[values]}},
{TextStyle->{FontSize->5}}
}

dataa2=Map[Graphics[#,opts]&,dataa1];

dataa3=GraphicsArray[Table[Take[dataa2,{i,Min[i+4,Length[dataa2]]}],{i,1,Length[dataa2],5}]
,Frame->True
]

Show[dataa3]

Display["PlotData.Cos.eps",dataa3,"EPS",{ImageSize->72
#,ImageOffset->{0,0}}&[7]]

(****************************************************************************)
(* Three dimensional
buisnss *)

Get["DiscreteMath`ComputationalGeometry`"]

pl=TriangularSurfacePlot[Map[Take[#,3]&,data],{BoxRatios->{1,1,1},DisplayFunction->Identity}]


0 new messages