Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: How show axes labels with AxesOrigin->{0,0,0} in 3D?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg119552] Re: How show axes labels with AxesOrigin->{0,0,0} in 3D?
  • From: Peter Breitfeld <phbrf at t-online.de>
  • Date: Thu, 9 Jun 2011 05:45:16 -0400 (EDT)
  • References: <isnllk$n7b$1@smc.vnet.net>

Murray Eisenberg wrote:

> Aha! Thanks for spotting that the 3D axes labels are really there. But 
> they're hardly in an optimal position.
>
> In 2D, the axes labels are at the ends of the axes. So you'd think, for 
> the sake of Mathematica's much-vaunted consistency, that the same would 
> be the case in 3D.
>
> The example does not really make a reasonable argument against using 
> axes in 3D that emanate from the origin. Rather, it makes a convincing 
> argument that WRI made a dumb design decision when they implemented 
> AxesOrigin for 3D.
>
> On 6/7/2011 6:46 AM, Robert Rosenbaum wrote:

I followed this thread and my opinion is, that at least in education
area axes trough the origin are often used. So I ended with the
following function, which places labels at the end of the axes and plot
any Graphics3D with axes:

NoOpt[x__]:=And@@(Not[OptionQ[#]]&)/@{x}

SyntaxInformation[AchsenStattPlot]=
    {"ArgumentsPattern"->{_,_.,_.,_.,_.,OptionsPattern[]}};
AchsenStattBox[g_Graphics3D,
  achsenOrigin_: {0, 0, 0},
  labFakt :(_Real | _Integer | _List) : 1.2,
  labColor_: Red,
  labSize_: 16,
  opts:OptionsPattern[]]/;NoOpt[achsenOrigin,labFakt,labColor,labSize]:=
 Module[{labels, o = achsenOrigin, xmax, ymax, zmax, lx, ly, lz},
  If[Head[labFakt] === List, {lx, ly, lz} = labFakt,
   {lx, ly, lz} = ConstantArray[labFakt, 3]];
  {xmax, ymax, zmax} = #[[2]] & /@ AbsoluteOptions[g, PlotRange][[1, 2]];
  labels = {
    Text[Style["x", labSize, labColor], {xmax lx, o[[2]], o[[3]]}], 
    Text[Style["y", labSize, labColor], {o[[1]], ymax ly, o[[3]]}], 
    Text[Style["z", labSize, labColor], {o[[1]], o[[2]], zmax lz}]};
  Show[{g, Graphics3D[{labels}]},
    AxesLabel->None, Boxed -> False, AxesOrigin -> o,Evaluate[opts]]
  ]

-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de


  • Prev by Date: Re: FixedPoint[Cos, 1.0]
  • Next by Date: Fast way to find neighbours of vertices in a Graph & possible performance bug in NeighborhoodGraph
  • Previous by thread: Re: How show axes labels with AxesOrigin->{0,0,0} in 3D?
  • Next by thread: Is there ToNumber?