Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Arrow HeadScaling?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg59078] Re: [mg59034] Arrow HeadScaling?
  • From: "David Park" <djmp at earthlink.net>
  • Date: Thu, 28 Jul 2005 02:26:54 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Yes, it is poorly explained. Here is some code that you can experiment with.

Needs["Graphics`Arrow`"]

With Relative scaling. This specifies the length of the arrowhead in terms
of the length of the arrow. Experiment, say by varying the length from 0.1
to 1 and try various imagesizes and aspect ratios. HeadCenter is also useful
if you want a barbed instead of a triangular arrowhead. HeadCenter would
generally be between 0 and 1.

With[
    {theta = Pi/4,
      aspect = Automatic,
      imagesize = 300,
      scaling = Relative,
      center = 0.5,
      length = 0.2},
    Show[Graphics[
        {Arrow[{5, 5}, {5, 5} + 3{Re[Exp[I theta]], Im[Exp[I theta]]},
            HeadScaling -> scaling,
            HeadLength -> length,
            HeadCenter -> center],
          AbsolutePointSize[5], Point[{5, 5}]}],
      AspectRatio -> aspect,
      PlotRange -> {{-0.02, 10.02}, {-0.02, 10.02}},
      Frame -> True,
      ImageSize -> imagesize]];

With Automatic scaling. The length of the arrowhead is specified in terms of
the width of the plot. (The height will have no effect.)

With[
    {theta = Pi/4,
      aspect = 1/GoldenRatio,
      imagesize = 300,
      scaling = Automatic,
      center = 0.5,
      length = 0.1},
    Show[Graphics[
        {Arrow[{5, 5}, {5, 5} + 3{Re[Exp[I theta]], Im[Exp[I theta]]},
            HeadScaling -> scaling,
            HeadLength -> length,
            HeadCenter -> center],
          AbsolutePointSize[5], Point[{5, 5}]}],
      AspectRatio -> aspect,
      PlotRange -> {{-0.02, 10.02}, {-0.02, 10.02}},
      Frame -> True,
      ImageSize -> imagesize]];

With Absolute scaling the length of the arrowhead is specified in printer
points (1/72 inch. But I don't know if this is always transferred exactly to
the screen or to a printed page.) Experiment with changing the imagesize and
you will see that the arrowhead stays the same size, even though the length
of the arrow on the screen changes.

With[
    {theta = Pi/4,
      aspect = Automatic,
      imagesize = 300,
      scaling = Absolute,
      center = 0.5,
      length = 20},
    Show[Graphics[
        {Arrow[{5, 5}, {5, 5} + 3{Re[Exp[I theta]], Im[Exp[I theta]]},
            HeadScaling -> scaling,
            HeadLength -> length,
            HeadCenter -> center],
          AbsolutePointSize[5], Point[{5, 5}]}],
      AspectRatio -> aspect,
      PlotRange -> {{-0.02, 10.02}, {-0.02, 10.02}},
      Frame -> True,
      ImageSize -> imagesize]];

When I look at the arrow at 45 degrees it seems that the arrowhead is not
quite correctly aligned. Also, there is a bug in the Arrow routine such that
if you try to plot arrows that are quite short compared to machine
precision, say on a plot that has overall small scale, then the routine
falls apart. Fortunately, users seldom try to plot such small arrows.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/






From: AES [mailto:siegman at stanford.edu]
To: mathgroup at smc.vnet.net


I know my brainpower is slowly fading with increasing years, but I've
now read the Help message for the Arrow graphics primitive --
specifically, the paragraph immediately following the table of Options
for the Arrow primitive (also on p. 140 of the Mathematica 3.0 Standard
Add-on
Packages) -- at least three times, and also done a few experiments; and
I'll be damned if I can grasp what it says about the HeadScaling
parameter and the Automatic and Absolute options for that parameter.

My only concern is controlling the size of the arrowheads, and having
them keep the same relative size if I change the ImageSize or
AspectRatio of the graphic in which they're imbedded; no special shapes
or the like.

Can anyone translate this paragraph into English?

(And thanks, I know there are some carefully crafted third-party Arrow
packages out there; but I'd just prefer to stick with Mathematica's built-in
primitive.)



  • Prev by Date: Re: Functional equations for HermiteH[n,x]
  • Next by Date: Re: NIntegrate::inum
  • Previous by thread: Re: Colorfunction along a line...
  • Next by thread: Re: 3d plots in mathematica 5.0