Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Clippling of polygons within a defined region
Replies: 2   Last Post: Aug 5, 1999 2:27 AM

 Messages: [ Previous | Next ]
 John Tanner Posts: 10 Registered: 12/7/04
Re: Clippling of polygons within a defined region
Posted: Aug 5, 1999 2:27 AM

In article <7o5ff4\$rgt@smc.vnet.net>, Allan Hayes
<hay@haystack.demon.co.uk> writes
>John,
>
>The same problem arises with big points, thick lines and with text.
>Here is an first attempt at dealing with it.
>

<Snip>
>
>One undesirable feature of this is that we are relying the hidden frame and
>ticks in gr to make room for the versions in fat.
>

<Snip>

Thank you very much! That gives me exactly what I needed. At first I
thought it was a complete solution but I now see what you mean about an
"undesirable feature". There seems to be a small problem with
FullGraphics in terms of the position and orientation of FrameLabels and
PlotLabel (fortunately easy to overcome: before, I had absolutely
nothing!).

*************example********************
In[1]:=
Module[{fat, pr, mask, e, x1, x2, y1,y2},
(*get the explicit graphics for frame, and frameticks*)
fat = Delete[FullGraphics[gr], {1, 1}];
(*get the explicit plotrange for gt*)
{{x1, x2}, {y1, y2}} = pr = PlotRange[gr];
(*calculate a suitable mask with style st*)
e = Max[x2 - x1, y2 - y1];
Polygon[{{x1, y1}, {x2, y1}, {x2, y2}, {x1, y2}, {x1, y1},
{x1 - e, y1 - e}, {x1 - e, y2 + e}, {x2 + e, y2 + e},
{x2 + e, y1 - e}, {x1 - e, y1 - e}}]}];
(*show the graphics in the right order*)
Show[gr, mask, fat, PlotRange -> pr]]

In[2]:=
gr2 = Show[
Graphics[{Polygon[{{-1, 0}, {2, -2}, {2, 1}}],
PointSize[0.5],Point[{1, 1}]}],
Frame -> True, FrameTicks -> True,
PlotRange -> {{0, 1}, {0, 1}},
FrameLabel -> {"X Axis", "Y Axis"},
PlotLabel -> "Plot Label"]

In[3]:=

In[4]:=
Select[ToString[#] & /@ Flatten[FullGraphics[gr2] /. Graphics -> List],
StringPosition[#, "Axis"] =!= {} &]

Out[4]=
{"Text[X Axis, {0.5, -0.0202254}, {0., 1.}]",
"Text[Y Axis, {-0.01875, 0.5}, {1., 0.}]"}
****************************************

This seems to show that Text is being called with 3 arguments, missing
the "offset" argument in position 3.

Incidentally, the behaviour of Display in generating output files is
rather different from Show. I still do not fully understand the
function overrides the previous Text calls etc., completely the opposite
to the behaviour of Show. The new Export command does give the same as
Show.

****************************************
In[5]:=
Display["c:\\temp\\tmp1.gif", gr2, "GIF"]

In[6]:=
Display["c:\\temp\\tmp2.gif", Masked[gr2, RGBColor[1, 1, 1]], "GIF"]

In[7]:=
Select[ToString[#] & /@
Flatten[Masked[gr2, RGBColor[1, 1, 1]] /. Graphics -> List],
StringPosition[#, "Axis"] =!= {} &]

Out[7]=
{"Text[X Axis, {0.5, -0.0202254}, {0., 1.}]",
"Text[Y Axis, {-0.01875, 0.5}, {1., 0.}]",
"FrameLabel -> {X Axis, Y Axis}"}
****************************************

Thank you again! This saved me much time.

John.

Date Subject Author
7/30/99 John Tanner
8/2/99 Allan Hayes
8/5/99 John Tanner