MathGroup Archive 2012

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

Search the Archive

Re: Adding to a plot

  • To: mathgroup at smc.vnet.net
  • Subject: [mg126177] Re: Adding to a plot
  • From: "djmpark" <djmpark at comcast.net>
  • Date: Mon, 23 Apr 2012 05:41:29 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <24429194.29030.1335089809072.JavaMail.root@m06>

You could use DrawingTools (Ctrl+D). However I do not recommend that because
it does not leave you with a permanent written specification of the graphic.
If you wanted to change the initial ParametricPlot part you would have to
redo all the hand-drawn parts. My experience is that custom graphics take
quite a bit of adjustment to finally obtain the result you want and it is
much better to work with a complete written specification that can be
modified and reevaluated.

The regular Mathematica paradigm for doing that is to use Epilog and Show
but this is just awkward enough to deter a large fraction of Mathematica
users. Items are not specified in a natural order and generally a great deal
of graphics level jumping is necessary.

The Presentations Application does allow you to work with a complete written
specification and to simply draw one item after another in a natural way.
Here is an example from the documentation showing how to produce a diagram
showing the geometry for calculating a center of mass. The example uses
custom scale lines with symbolic tick values, with the y axis on the right,
and is highly commented to show how each item is drawn one after another.

<<Presentations` 

Module[
 {xloc = 1, (* Vertical integration slice location *)
  delx = .1, (* Depicted width of integration slice *)
  yloc, cmyloc},
 
 (* Calculation of top and midpoint of integration slice *)
 yloc = (4 - xloc^2);
 cmyloc = yloc/2;
 
 (* The drawing statement *)
 Draw2D[
  {(* Draw the parabola with filling to the axis. 
   Notice that the Filling option affects how the parabola is drawn \
and must be in the Draw statement. *)
   Draw[4 - x^2, {x, -2, 2}, Filling -> Axis],
   
   (* Draw faint lines from the midpoint and top of slice to the \
vertical axis *)
   {LightGray,
    Line[{{xloc, cmyloc}, {2, cmyloc}}],
    Line[{{xloc, yloc}, {2, yloc}}]},
   
   (* Draw the vertical integration slice in transparent blue *)
   {Opacity[.6, Legacy@RoyalBlue],
    Rectangle[{xloc - delx, 0}, {xloc + delx, yloc}]},
   
   (* Mark the center of mass of the vertical slice *)
   CirclePoint[{xloc, cmyloc}, 2, Black, Blue],
   
   (* Draw the horizontal and vertical scales with symbolic points \
marked *)
   XSymbolicScale[{-2.2, 2.2, 0}, {-2.2, 
     2.2}, {{-2, -2}, {0, 0}, {xloc, x}, {2, 2}}],
   YSymbolicScale[{0, 4.2, 2}, {0, 4.2},
    {{cmyloc, (4 - x^2)/2, {-1, 0}}, {yloc, (4 - x^2), {-1, 0}}, {4, 
      4}},
    0, -0.02, 0.03],
   
   (* Label the center of mass of the slice, the x and y axis, 
   and add a larger font title to the graphic *)
   Text["C.M.", {xloc, cmyloc}, {1.6, 0}],
   Text[x, {2.4, 0}],
   Text[y, {2, 4.4}],
   Text[Style["Geometry for Calculating\nCenter of Mass", 16], {-2, 
     4.5}, {-1, 0}]} (* 
  End of the specification of the graphic primitives *),
  
  (* The overall graphic options go here. 
  These are options that affect the overall appearance of the plot \
and have nothing to do with how individual items are drawn. *)
  PlotRange -> {{-2.2, 3.4}, {-0.4, 5.0}},
  BaseStyle -> {FontSize -> 12},
  ImageSize -> 350]
 ]


David Park
djmpark at comcast.net 
http://home.comcast.net/~djmpark/index.html 




From: sam.takoy at yahoo.com [mailto:sam.takoy at yahoo.com] 


Hi,

If I plot something using ParametricPlot and later want to add something to
the same plot, how is that done?

Many thanks in advance,

Sam




  • Prev by Date: Re: Instability with Dynamic content
  • Next by Date: Re: evaluating functions and displaying results numerically
  • Previous by thread: Re: Adding to a plot
  • Next by thread: Serious Bug in Mathematica 7 and 8.0.4.0 (latest version)