Re: Mathematica: ListPlot, Filling->Axis with Joined->True problem
- From: "David Park" <djmpark@xxxxxxxxxxx>
- Date: Wed, 9 Jan 2008 09:17:26 -0500
You can certainly do this with regular Mathematica but it is always somewhat of a chore to make graphics that combine elements from various plot types and possibly include regular graphics primitives and directives. The Presentations package, from my web site and which costs $50 does this naturally by treating all plot types as graphics primitives that can be combined with other primitives. So I would do it as follows:
Needs["Presentations`Master`"]
t = Table[RandomInteger[100], {10}];
Draw2D[
{PointSize[Large],
ListDraw[t, Filling -> Axis, AxesOrigin -> {0, 0}],
ListDraw[t, Joined -> True]},
AspectRatio -> 1/GoldenRatio,
Frame -> True,
ImageSize -> 350]
Or, if you want draw a line instead of using ListDraw you could use:
Draw2D[
{PointSize[Large],
ListDraw[t, Filling -> Axis, PlotRange -> {0, 100}],
Line[Transpose[{Range[Length[t]], t}]]},
AspectRatio -> 1/GoldenRatio,
Frame -> True,
ImageSize -> 350]
If you didn't want filling you could dispense with ListDraw and Presentations altogether and just use:
t = Table[RandomInteger[100], {10}];
Graphics[
{PointSize[Large],
Point /@ Transpose[{Range[Length[t]], t}],
Line[Transpose[{Range[Length[t]], t}]]},
AspectRatio -> 1/GoldenRatio,
Frame -> True,
ImageSize -> 350]
Or if you wanted filling without ListPlot you could use:
Module[
{t = Table[RandomInteger[100], {10}], pts, fillroutine},
pts = Transpose[{Range[Length[t]], t}];
fillroutine = {GrayLevel[.8], Line[{{First[#], 0}, #}]} &;
Graphics[
{PointSize[Large],
Point /@ pts,
Line[pts],
fillroutine /@ pts},
AspectRatio -> 1/GoldenRatio,
Frame -> True,
ImageSize -> 350]
]
--
David Park
djmpark@xxxxxxxxxxx
http://home.comcast.net/~djmpark/
"Nasser Abbasi" <nma@xxxxxxxxx> wrote in message news:RyEfj.25802$R92.4217@xxxxxxxxxxxxxxx
This is Mathematica 6.0.1
In this example I use Filling->Axis to obtain vertical lines
t = Table[RandomInteger[100], {10}]
ListPlot[t, Joined -> False, Mesh -> Full, PlotStyle -> PointSize[Large], Frame -> True, Filling -> Axis]
I can have the points joined by line by making the Joined->True in the above, but then the whole space is filled and the vertical lines are gone.
t = Table[RandomInteger[100], {10}]
ListPlot[t, Joined -> False, Mesh -> Full, PlotStyle -> PointSize[Large], Frame -> True, Filling -> Axis]
I need to have the vertical lines remain there, and have the points joined as well, but without that filling of the space below. I looked at Filling and FillingStyle, and Joined options, but do not see a way to do it. Any one knows a trick to do this? (have the vertical lines show up, and have the points Joined as well?)
Currently I superimpose the ListPlot plot on top of a separate plot generated using Line[] which does the connection between the points to get the desired effect.
thanks,
Nasser
.
- Follow-Ups:
- Re: Mathematica: ListPlot, Filling->Axis with Joined->True problem
- From: Nasser Abbasi
- Re: Mathematica: ListPlot, Filling->Axis with Joined->True problem
- References:
- Mathematica: ListPlot, Filling->Axis with Joined->True problem
- From: Nasser Abbasi
- Mathematica: ListPlot, Filling->Axis with Joined->True problem
- Prev by Date: Re: Power Question
- Next by Date: which computer system for non-commutative algebras?
- Previous by thread: Mathematica: ListPlot, Filling->Axis with Joined->True problem
- Next by thread: Re: Mathematica: ListPlot, Filling->Axis with Joined->True problem
- Index(es):
Relevant Pages
|