Re: Re: How to combine graphics pimitives and Plot function?
- To: mathgroup at smc.vnet.net
- Subject: [mg107085] Re: [mg107024] Re: [mg107011] How to combine graphics pimitives and Plot function?
- From: "David Park" <djmpark at comcast.net>
- Date: Tue, 2 Feb 2010 03:29:19 -0500 (EST)
- References: <201001311253.HAA14187@smc.vnet.net> <201002011109.GAA22366@smc.vnet.net> <4664648.1265075682559.JavaMail.root@n11>
To elaborate some more: There are basically two kinds of graphics options, those that affect how some object is drawn (such as PlotPoints, MaxRecursion, or Mesh) and those that affect the overall appearance of the graphic (such as Frame, FrameTicks, AspectRatio, ImageSize) but do not affect the graphics primitives that represent the objects. For casual users using the Show statement these distinctions become somewhat of a blur and it is not clear where the various options are coming from, or where they should be placed. Nor do they find it easy to combine algorithm generated curves or surfaces with graphics primitives. Many of the experts on MathGroup know how to handle the Show statement, how to fix up options, and how to jump graphics levels. But this is a significant barrier to most casual users. It is enough of a barrier that many of them don't even try custom graphics. Primitives like Draw (for Plot) and ContourDraw (for ContourPlot) have many fewer options than Plot and ContourPlot. In the following you wouldn't put Frame in ContourDraw. It would have no effect on the resulting primitives, and if you put it in the statement it would show up as not being a proper option. The curve would be drawn as Red. Draw2D[ {Red, ContourDraw[y == Sin[x], {x, 0, 2 \[Pi]}, {y, -1, 1}]}, Frame -> True] But there are caveats. The following ContourDraw statement would not pick up the Red color because contour colors are embedded more deeply in the primitives and specified by a ContourStyle option. Draw2D[ {Red, ContourDraw[Sin[x y], {x, 0, 2 \[Pi]}, {y, 0, 2 \[Pi]}, Contours -> 4, ContourShading -> None]}, Frame -> True, ImageSize -> 250] Here Contours and ContourShading and ContourStyle (if we used it) would go in the ContourDraw statement because they affect what elements are drawn and how. But Frame and ImageSize would not go into ContourDraw because they have no effect there, nor would one logically expect them to have an effect. Then there are a couple of options, such as PlotRange that might appear in both places. In ContourDraw, for example, Mathematica might eliminate certain portions of the curves as being outliers or 'uninteresting'. One could control this using a 'z' PlotRange in the ContourDraw statement, and then one might use an 'x' and 'y' PlotRange for the overall Draw2D statement. So we might have a number of PlotRange options controlling separate portions of the graphic. Once one understands how these things work it is much more logical and easy to build up custom graphics (and custom dynamics too). As I like to say, you just draw one thing after another and you put the options where they logically do something. Another nice feature in Presentations is the OptionFinder that was contributed by Thomas M=FCnch and Syd Geraghty. It provides a quick method to find the options for various statements, and all the drawing statements, clicking the options into the statement, or quickly accessing Help for them. Another nice feature of always working on the graphics primitives level is that it is very easy to apply various transformations to individual parts. One might generate some basic object and then transform it to multiple objects, while leaving other objects fixed. David Park djmpark at comcast.net http://home.comcast.net/~djmpark/ From: DrMajorBob [mailto:btreat1 at austin.rr.com] Presentations gives the same graph with even LESS complexity, too: Draw2D[{Draw[Sin[x], {x, -Pi, Pi}], Red, Line[points]}, Axes -> True] (No need to put Red and Line in a List together.) I think David deliberately made Draw2D's argument a List in order to emphasize this point, or something like it. Directives and graphics are sequentially applied, and Draw2D options apply to the overall drawing. This works just as we'd expect it to, as well: Draw2D[{Blue, Draw[Sin[x], {x, -Pi, Pi}], Red, Line[points], Draw[Cos[x], {x, -Pi, Pi}]}, Axes -> True] and so does this: Draw2D[{Blue, Draw[Sin[x], {x, -Pi, Pi}], Red, Line[points], Draw[Cos[x], {x, -Pi, Pi}]}, Axes -> True, AxesStyle -> Purple, Background -> LightPink] Bobby
- References:
- Re: How to combine graphics pimitives and Plot function?
- From: Murray Eisenberg <murray@math.umass.edu>
- Re: How to combine graphics pimitives and Plot function?