MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Graphics3D Problem

  • To: mathgroup at smc.vnet.net
  • Subject: [mg103835] Re: [mg103808] Graphics3D Problem
  • From: Bob Hanlon <hanlonr at cox.net>
  • Date: Thu, 8 Oct 2009 07:52:19 -0400 (EDT)
  • Reply-to: hanlonr at cox.net

Use BoxRatios. Also, you might want to rotate two of the axes labels.

dataPts = {{"Brazil", "EWZ", 4., 0.64, 0.39}, {"PAC", "EPP", 6., 0.61,
     0.17}};

Graphics3D[{
  Blue,
  Style[
   Text[#[[2]], #[[{3, 4, 5}]], {1.6, 0}] & /@ dataPts,
   12, Bold],
  Red,
  AbsolutePointSize[4],
  Point[dataPts[[All, {3, 4, 5}]]]},
 BoxRatios -> {1, 1, 1},
 Axes -> True,
 AxesOrigin -> {0, 0, 0},
 AxesLabel -> {
   "Years",
   Rotate["Percent", Pi/4],
   Rotate["Ann TR\n", Pi/2]},
 LabelStyle -> Directive[Bold, 14]]


Bob Hanlon

---- donabc at comcast.net wrote: 

=============

I am trying to produce a 3D graph of data points like
the following two points  (simplified) :

dataPts = {{"Brazil", "EWZ", 4., 0.64, 0.39}, {"PAC", "EPP", 6., 0.61,
0.17}}


The x values are 4 and 6
The y values are 0.64 and 0.61
The z values are 0.39 and 0.17

The labels for the data points come from the second element in each
sublist above ("EWZ" and "EPP").
The data have widely differing values (in relative terms within each
sublist), which
is why I think I am having a problem.

I am using the following code, which produces a monstrosity as you can
see:

g3D = Graphics3D[{AbsolutePointSize[4],

              Module[{loc = Part[#, {3, 4, 5}], val = Part[#, 2]},
                       {Point[loc], Style[Text[Row[{val}], loc, {-1.6,
0}], FontSize -> 12, Bold]  }] & /@ dataPts},

      Axes -> True,  AxesOrigin -> {0, 0, 0},
      AxesLabel -> {"Years", "Percent", "Ann TR"},
      LabelStyle -> Directive[Bold, FontSize -> 14]
            ];

    Print[g3D];

(I have used many of the options like PlotRange with no solution in
sight.)

 In the graph I am trying to produce,  the x axis  ("Years" , the x
values) should be the width of the
 3D box with the axis going from left to right in the foreground
labeled "Years" . (Labeled at the bottom
 of the graph, NOT at the top!).

 The y axis [ "Percent" ] should look like it's going into the
background (with the "Percent" going alongside it at the bottom)  and
the z axis
 ["Ann. TR"]  should look like the height axis going up.

 The entire graph should be (more or less) a cuboid.  But, because the
x, y, z values
 differ so much in relative terms, the graph looks ridiculously
elongated.

 For example, the "Years" axis in the graph produced by the code above
is roughly 7 times longer
 than the other axes.  The shorter axes (the ones labeled "Ann. TR"
and "Percent") should
 be roughly the same size in the finished graph as the "Years"
axis.

 Bottom line, I am trying to produce a graph that has different scales
for the different axes - much like a common sense person would produce
if they were drawing the graph free hand with this data.

 (The graph I am trying to produce does not have to have all the axes
origins starting at 0, but  it seemed that was the best way to go.)

 Any help would be appreciiated.  Thank youi in advance.




  • Prev by Date: Re: Graphics3D Problem
  • Next by Date: Re: confused about == vs === in this equality
  • Previous by thread: Re: Graphics3D Problem
  • Next by thread: Usage Messages Have Become a High Tech Kludge