DiscretePlot or Plot to get subdivided bars?
- To: mathgroup at smc.vnet.net
- Subject: [mg121319] DiscretePlot or Plot to get subdivided bars?
- From: "Christopher O. Young" <cy56 at comcast.net>
- Date: Sat, 10 Sep 2011 07:29:02 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
I'm trying to get bars which will be divided up into unit squares, so I can illustrate finite differences and their relation to derivatives. Is there any way to use some special filling directives with DiscretePlot in order to do this? The notebook is at http://home.comcast.net/~cy56/DiscretePlotBars.nb and a picture is at http://home.comcast.net/~cy56/DiscretePlotBars.png. Maybe the quickest way to do this is to write my own function. Chris Young cy56 at comcast.net Manipulate[ Show[ { Plot[ p[a, b, c, d, x], {x, Subscript[x, 1], Subscript[x, 2]}, PlotStyle -> Red ], Plot[ \!\( \*SubscriptBox[\(\[PartialD]\), \(x\)]\(p[a, b, c, d, x]\)\) // Evaluate, {x, Subscript[x, 1], Subscript[x, 2]}, PlotStyle -> Orange ], DiscretePlot[ p[a, b, c, d, x], {x, Subscript[x, 1], Subscript[x, 2]}, ExtentSize -> 0.4, PlotMarkers -> {"Point", Medium}, PlotStyle -> Red, Filling -> Axis ], DiscretePlot[ \!\( \*SubscriptBox[\(\[PartialD]\), \(x\)]\(p[a, b, c, d, x]\)\) // Evaluate, {x, Subscript[x, 1] + 0.5, Subscript[x, 2] + 0.5}, ExtentSize -> 0.4, PlotMarkers -> {"Point", Medium}, PlotStyle -> Orange, Filling -> Axis ] }, GridLines -> {Range[Subscript[x, 1], Subscript[x, 2]], Range[Subscript[y, 1], Subscript[y, 2]]}, GridLinesStyle -> Directive[LightGray, Dashed], AxesOrigin -> {0, 0}, PlotRange -> {Subscript[y, 1], Subscript[y, 2]}, AspectRatio -> 1 ], {{a, 1}, -4, 4, 1/32}, {{b, 0}, -4, 4, 1/32}, {{c, 0}, -4, 4, 1/32}, {{d, 0}, -4, 4, 1/32}, {{Subscript[x, 1], -4}, -16, 16, 0.5}, {{Subscript[x, 2], 4}, -16, 16, 0.5}, {{Subscript[y, 1], -4}, -16, 16, 0.5}, {{Subscript[y, 2], 4}, -16, 16, 0.5} ]