Home > Archive > Mathematica > May 2006 > FilledListPlot with StackGraphics
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
FilledListPlot with StackGraphics
|
|
| Seo Ho Youn 2006-05-29, 8:12 am |
| Hi, all.
I am trying to use FilledListPlot with StackGraphics. The plot of
FilledListPlot looks fine, but when I bring it to 3D with StackGraphics, it
``overfilled''. I know that I can use Fills-> White in order not to show
this overfilled region. However, since I am trying to use several layers,
this overfilled region blocks the ones behind it. Here's my simplified code.
<<Graphics`FilledPlot`
<<Graphics`Graphics3D`
FLP = FilledListPlot[{{1, 1}, {2, 1}, {2, 2}, {3, 2}}];
Show[StackGraphics[FLP]];
In my code, there is a step plot in FilledListPlot. However, in 3D
(StackGraphics), there is an extra filled triangle with points (1,1), (2,1),
and (2,2), which is not filled in FilledListPlot.
How can I get rid of this extra filled region?
Thank you for reading. Have a good day.
Seo Ho
| |
| Bob Hanlon 2006-05-30, 4:15 am |
| Needs["Graphics`"];
The extraneous fill for StackGraphics changes depending on whether the base list in FilledListPlot is implicit (FLP1) or explicit (FLP2).
DisplayTogetherArray[{{
FLP1 = FilledListPlot[
{{1, 1}, {2, 1}, {2, 2}, {3, 2}}],
FLP2 = FilledListPlot[{{1,0},{3,0}},
{{1, 1}, {2, 1}, {2, 2}, {3, 2}}]},
{Show[StackGraphics[{FLP2,FLP1}]]}},
ImageSize->600];
The same happens with FilledPlot and StackGraphics
DisplayTogetherArray[{{
fp1=FilledPlot[
1+UnitStep[x-2],{x,1,3}],
fp2=FilledPlot[
{0,1+UnitStep[x-2]},{x,1,3}]},
{Show[StackGraphics[{fp2,fp1}]]}},
ImageSize->600];
However, no problem occurs with graphic primitives or InequalityPlot
DisplayTogetherArray[{{
sg1=Show[Graphics[{Gray,
Rectangle[{1, 0}, {3, 1}],
Rectangle[{2, 1}, {3, 2}]}]],
sg2=Show[Graphics[{Gray,
Rectangle[{1, 0}, {2, 1}],
Rectangle[{2, 0}, {3, 2}]}]]},
{Show[StackGraphics[{sg1,sg2}]]}},
ImageSize->600];
ip=InequalityPlot[x<2&&y<1||x>2&&y<2,
{x,1,3}, {y,0,2},AspectRatio->1/GoldenRatio];
Show[StackGraphics[ip]];
Bob Hanlon
---- SEO Ho Youn <ysh7873@hotmail.com> wrote:
> Hi, all.
>
>
>
> I am trying to use FilledListPlot with StackGraphics. The plot of
> FilledListPlot looks fine, but when I bring it to 3D with StackGraphics, it
> ``overfilled''. I know that I can use Fills-> White in order not to show
> this overfilled region. However, since I am trying to use several layers,
> this overfilled region blocks the ones behind it. Here's my simplified code.
>
>
>
> <<Graphics`FilledPlot`
>
> <<Graphics`Graphics3D`
>
>
>
> FLP = FilledListPlot[{{1, 1}, {2, 1}, {2, 2}, {3, 2}}];
>
> Show[StackGraphics[FLP]];
>
>
>
> In my code, there is a step plot in FilledListPlot. However, in 3D
> (StackGraphics), there is an extra filled triangle with points (1,1), (2,1),
> and (2,2), which is not filled in FilledListPlot.
>
>
>
> How can I get rid of this extra filled region?
>
>
>
> Thank you for reading. Have a good day.
>
>
>
> SEO Ho
>
| |
| David Park 2006-05-30, 4:15 am |
| Seo Ho,
You could skip FilledListPlot and try something like the following.
data = {{1, 1}, {2, 1}, {2, 2}, {3, 2}};
data2 = Partition[data, 2, 2]
{{{1, 1}, {2, 1}}, {{2, 2}, {3, 2}}}
data3 = data2 /. {{x1_?NumericQ, y1_}, {x2_, y2_}} ->
Polygon[{{x1, 0}, {x1, y1}, {x2, y2}, {x2, 0}}]
{Polygon[{{1, 0}, {1, 1}, {2, 1}, {2, 0}}],
Polygon[{{2, 0}, {2, 2}, {3, 2}, {3, 0}}]}
Show[StackGraphics[Graphics@data3]]
Or you could also dispense with StackGraphics and write a routine that will
convert your list specification to 3d Polygons at a specific y value.
data3d[data2d_, y_] :=
Module[{work},
work = Partition[data2d, 2, 2];
work /. {{x1_?NumericQ, z1_}, {x2_, z2_}} ->
Polygon[{{x1, y, 0}, {x1, y, z1}, {x2, y, z2}, {x2, y, 0}}]
]
data1 = {{1, 1}, {2, 1}, {2, 2}, {3, 2}, {3, 1/2}, {4, 1/2}};
data2 = {{1, 1}, {2, 1}, {2, 3}, {3, 3}, {3, 1}, {4, 1}};
Show[
Graphics3D[
{data3d[data1, 1],
data3d[data2, 2]}]
You might also be able to simplify how you specify and process your lists of
data. It is almost always easier to work directly with primitive graphics
objects than to try to twist some of the Mathematica plot types to special
use.
David Park
djmp@earthlink.net
http://home.earthlink.net/~djmp/
From: SEO Ho Youn [mailto:ysh7873@hotmail.com]
Hi, all.
I am trying to use FilledListPlot with StackGraphics. The plot of
FilledListPlot looks fine, but when I bring it to 3D with StackGraphics, it
``overfilled''. I know that I can use Fills-> White in order not to show
this overfilled region. However, since I am trying to use several layers,
this overfilled region blocks the ones behind it. Here's my simplified code.
<<Graphics`FilledPlot`
<<Graphics`Graphics3D`
FLP = FilledListPlot[{{1, 1}, {2, 1}, {2, 2}, {3, 2}}];
Show[StackGraphics[FLP]];
In my code, there is a step plot in FilledListPlot. However, in 3D
(StackGraphics), there is an extra filled triangle with points (1,1), (2,1),
and (2,2), which is not filled in FilledListPlot.
How can I get rid of this extra filled region?
Thank you for reading. Have a good day.
Seo Ho
| |
| Hartmut.Wolf@t-systems.com 2006-05-31, 8:16 am |
|
> -----Original Message-----
> From: SEO Ho Youn [mailto:ysh7873@hotmail.com]
> Subject: FilledListPlot with StackGraphics
>
> Hi, all.
>
>
>
> I am trying to use FilledListPlot with StackGraphics. The plot of
> FilledListPlot looks fine, but when I bring it to 3D with
> StackGraphics, it
> ``overfilled''. I know that I can use Fills-> White in order
> not to show
> this overfilled region. However, since I am trying to use
> several layers,
> this overfilled region blocks the ones behind it. Here's my
> simplified code.
>
>
>
> <<Graphics`FilledPlot`
>
> <<Graphics`Graphics3D`
>
>
>
> FLP = FilledListPlot[{{1, 1}, {2, 1}, {2, 2}, {3, 2}}];
>
> Show[StackGraphics[FLP]];
>
>
>
> In my code, there is a step plot in FilledListPlot. However, in 3D
> (StackGraphics), there is an extra filled triangle with
> points (1,1), (2,1),
> and (2,2), which is not filled in FilledListPlot.
>
>
>
> How can I get rid of this extra filled region?
>
>
>
> Thank you for reading. Have a good day.
>
>
>
> SEO Ho
>
>
>
Seo Ho,
if g = Show[StackGraphics[FLP]] then
In[10]:= g /. Polygon[pts_] :> Polygon[RotateLeft[pts]]
In[11]:= % // Show
resolves the problem of your example (but certainly not of your application).
The problem with the Mathematica 3D Polygon is that it must be star convex to display properly, and the starting point and each line segment from the starting point to any vertex must be contained within the polygon.
Such in general you have to cut your polygons from FilledListPlot into parts with that property. In particular a convex decomposition would do. You certainly will find some Mathematica software out there that does this job. Then you have to tie it togethe
r for your application.
--
Hartmut
|
|
|
|
|