MathGroup Archive 2009

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

Search the Archive

Re: Bugs in FullGraphics and AbsoluteOptions and temporary workaround

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101371] Re: Bugs in FullGraphics and AbsoluteOptions and temporary workaround
  • From: Alexey <lehin.p at gmail.com>
  • Date: Fri, 3 Jul 2009 05:38:55 -0400 (EDT)
  • References: <h2i4ik$8re$1@smc.vnet.net>

The above-code without a bug caused by automatic wrapping:

=======Start of code=========

g = Plot[Cos[x], {x, 0.2, 10}]

(*Generating explicit PlotRange with respect to PlotRangePadding and \
AxesOrigin*)
axsOr = AxesOrigin /. AbsoluteOptions[g];
pltR = PlotRange /. AbsoluteOptions[g];
pltRPad = PlotRangePadding /. Options[g];
Which[
 pltRPad === {Scaled[0.02], Scaled[0.02]} (*The default value*),
 \[CapitalDelta]x = 0.02 (pltR[[1, 2]] - pltR[[1, 1]]);
 \[CapitalDelta]y = 0.02 (pltR[[2, 2]] - pltR[[2, 1]]);
 pltR = pltR + {{-\[CapitalDelta]x, \[CapitalDelta]x}, \
{-\[CapitalDelta]y, \[CapitalDelta]y}};
 ]
Do[
 pltR[[i, 1]] = Min[axsOr[[i]], pltR[[i, 1]]];
 pltR[[i, 2]] = Max[axsOr[[i]], pltR[[i, 2]]],
 {i, {1, 2}}]
(*Generating the list of necessary options*)
options =
  Table[opt -> (opt /. AbsoluteOptions[g]), {opt, {AxesOrigin, Axes,
      AspectRatio}}]~Join~{PlotRange -> pltR};
(*We recreate original plot, but with explicit PlotRange option*)
gg = Graphics[g[[1]], options]
(*FullGraphics*)
ggg = Show[FullGraphics[gg],
  AspectRatio -> (AspectRatio /. Options[g])]
(*Overlapping FullGraphics and original plot*)
Graphics[{g[[1, 1]], FullGraphics[gg][[1]]}, options,
 ImageSize -> {260, 154}]


(*Generating explicit Ticks specification*)
(*This uses CustomTicks packege from \
http://library.wolfram.com/infocenter/MathSource/5599 *)
Needs["CustomTicks`"]
options = Append[options, Ticks -> (LinTicks @@ # & /@ pltR)];
(*We recreate original plot, but with explicit PlotRange and Ticks \
options*)
gg2 = Graphics[g[[1]], options]
(*FullGraphics*)
ggg2 = Show[FullGraphics[gg2],
  AspectRatio -> (AspectRatio /. Options[g])]
(*Overlapping FullGraphics and original plot*)
Graphics[{g[[1, 1]], FullGraphics[gg2][[1]]}, options,
 ImageSize -> {260, 154}]

=======End of code=========


  • Prev by Date: Re: Bug Report: Excessively thin Thin?
  • Next by Date: Collect exponents only
  • Previous by thread: Re: Re: NDSolve to solve a set of "loop" equations
  • Next by thread: Collect exponents only