MathGroup Archive 2006

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

Search the Archive

RE: Re: Graphics/PlotRange/LaTeX/Psfrag

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70553] RE: [mg70508] Re: Graphics/PlotRange/LaTeX/Psfrag
  • From: "David Park" <djmp at earthlink.net>
  • Date: Thu, 19 Oct 2006 03:22:59 -0400 (EDT)

Paul,

It is difficult to understand precisely what your overall objective is here.
Nevertheless I think this is a case where the regular Mathematica graphics
paradigm is very confusing. By doing a sequence of Show statements you are
getting various overall plot options embedded in the graphics and then
somehow losing track of them, or rather you want to embed the option in one
case but then don't want it in another case WITHOUT explicitly specifying
that you don't want it anymore.

There are two kinds of plot options, ones that affect the rendering of
specific objects such as curves, and ones that affect the overall appearance
of the plot. An example of the first kind might be PlotPoints or PlotStyle.
An example of the second kind might be ImageSize or PlotRange.

In making plots, it is usually much better to explicitly give the options
for each plot. Assume that each plot requires its own treatment. If you
really do have many plots that fit into the same framework then I will show
you how to do that later.

This is how I would approach this with DrawGraphics.

Needs["DrawGraphics`DrawingMaster`"]

First I generate the Line primitive for the Sin curve and save it. I
included the PlotPoints option just as an example, although it wouldn't
really be needed in this case.

gsin = Draw[Sin[x], {x, -2Pi, 2Pi}, PlotPoints -> 100];

To draw your first type of plot I would then use...

Draw2D[
    {gsin},
    Axes -> True];

To draw the second type of plot (where I also made the curve Blue) I would
use...

Draw2D[
    {Blue, gsin},
    Frame -> True,
    PlotRange -> {{0, 2 Pi}, {-0.5, 1}}];

If you were to make many plots that would use the same framework you could
define the following (where I have just used a typical set of options).
Notice that I allow specific additional options to be supplied with the opts
argument, and the function places them before any built-in options
(otherwise they would not override the built-in options).

standardPlot[{primitives_}, opts___?OptionQ] :=
    Draw2D[{primitives},
      opts,
      Frame -> True,
      ImageSize -> 500,
      PlotLabel -> "Standard Plot",
      Background -> Linen];

Then to do a standard plot you would use...

standardPlot[{gsin}];

but to do a plot with different overall plot option, say to change from a
Frame plot to an Axes plot and change the PlotLabel, you could use...

standardPlot[{gsin},
    Axes -> True,
    Frame -> False,
    PlotLabel -> "Sine Wave"];

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

From: Paul [mailto:pw23 at gmx.net]
To: mathgroup at smc.vnet.net


For a better understanding of my question take the following example:

g0 = Plot[Sin[x], {x, -2*Pi, 2*Pi}];

g1 = Show[g0, Frame -> True, PlotRange ->{{0, 2*Pi}, {-0.5, 1}}];

g1 has not "lost" its origin due to the fact, that

Show[g1,PlotRange->All]

is identical to g0. It has still all information!

The best would be a function F[] which makes the following

g0 = Plot[Sin[x], {x, -2*Pi, 2*Pi}];
g1 = Show[g0, Frame -> True, PlotRange -> {{0, 2*Pi}, {-0.5, 1}}];
g2=F[g1];

and g2 has now the feature that

Show[g2,PlotRange->All]

is identical to g1.

Do you know such a function?

Best regards,
Paul



  • Prev by Date: Re: sum of binomials .. bug ?
  • Next by Date: Re: Infinity vs DirectedInfinity[1]
  • Previous by thread: Re: Graphics/PlotRange/LaTeX/Psfrag
  • Next by thread: Re: Graphics/PlotRange/LaTeX/Psfrag