Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Bugs in FullGraphics and AbsoluteOptions and temporary workaround
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Alexey  
View profile  
 More options Jul 2 2009, 7:10 am
Newsgroups: comp.soft-sys.math.mathematica
From: Alexey <lehi...@gmail.com>
Date: Thu, 2 Jul 2009 11:10:12 +0000 (UTC)
Local: Thurs, Jul 2 2009 7:10 am
Subject: Bugs in FullGraphics and AbsoluteOptions and temporary workaround
Hello,

There is one major bug in FullGraphics (as well as in Absolute
Options):
FullGraphics uses PlotRange from the AbsoluteOptions and fully ignores
PlotRangePadding (new in Mathematica version 6) and AxesOrigin (new in
2) options.
This is the reason for clipping the X-axis that we see here:

g = Plot[Sin[x], {x, 0.2, 10}]
Show[FullGraphics[g], AspectRatio -> 1/GoldenRatio]

And this is also reason for wrong Ticks specifications generated by
FullGraphics and AbsoluteOptions.

I have developed a program for generating explicit values of PlotRange
with respect to AxesOrigin and PlotRangePadding options. It is assumed
in this program that PlotRangePadding has it's default value {Scaled
[0.02], Scaled[0.02]}.
The code follows:

=======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=========

And what I have also found about FullGraphics function:
It doesn't appear to have been updated since V2: see bottom of the
page
http://reference.wolfram.com/mathematica/ref/FullGraphics.html :(


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alexey  
View profile  
 More options Jul 3 2009, 5:35 am
Newsgroups: comp.soft-sys.math.mathematica
From: Alexey <lehi...@gmail.com>
Date: Fri, 3 Jul 2009 09:35:15 +0000 (UTC)
Local: Fri, Jul 3 2009 5:35 am
Subject: Re: Bugs in FullGraphics and AbsoluteOptions and temporary workaround
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=========


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google