[Date Index]
[Thread Index]
[Author Index]
RE: Changing ErrorBar colors but keeping serifs
*To*: mathgroup at smc.vnet.net
*Subject*: [mg49852] RE: [mg49840] Changing ErrorBar colors but keeping serifs
*From*: "David Park" <djmp at earthlink.net>
*Date*: Wed, 4 Aug 2004 10:46:30 -0400 (EDT)
*Sender*: owner-wri-mathgroup at wolfram.com
David,
I always find MultipleListPlot and all its options very baroque. If you want
to wander too far from the established set-piece plot, such as using colored
error bars, it becomes a real chore to figure out how to do it. Perhaps
someone will supply a simple solution.
I would abandon MultipleListPlot altogether, write my own error bar routine
and do it this way.
Needs["Graphics`Colors`"]
Here is some sample data. It's a list of {x, y, {down error, up error}}.
data = Table[{x, x^2*((1 + x)/200) + Random[Real, {-0.5, 0.5}],
{-Random[Real, {0.1, 0.5}], Random[Real, {0.1, 0.5}]}},
{x, 0, 10}];
The points themselves can be extracted from the complete data.
coorddata = Take[#, 2] & /@ data;
Here is a routine to plot the error bars and points. It's exact form would
depend on how you packaged your data.
PointWithError[color_, width_][{x_, y_, {neg_, pos_}}] := {color,
Line[{{x, y + neg}, {x, y + pos}}],
Line[{{x - width/2, y + pos}, {x + width/2, y + pos}}],
Line[{{x - width/2, y + neg}, {x + width/2, y + neg}}],
Black, Point[{x, y}]}
We can then plot the data line and the points with error bars simply by
wrapping coorddata in Line, and by mapping PointWithError onto the data.
Show[
Graphics[
{Line[coorddata],
AbsolutePointSize[4],
PointWithError[Red, 0.1] /@ data}],
Frame -> True,
Background -> Linen,
ImageSize -> 400];
If I wanted to plot a fitted line instead of the connected data points, I
would use the DrawGraphics package from my web site below. Then we use a
similar construction but just substitute a curve for the Line.
Needs["DrawGraphics`DrawingMaster`"]
fitcurve[x_] = Fit[coorddata, {x, x^3}, x]
Draw2D[
{Draw[fitcurve[x], {x, 0, 10}],
AbsolutePointSize[4],
PointWithError[Red, 0.1] /@ data},
Frame -> True,
Background -> Linen,
ImageSize -> 400];
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: David O'Gorman [mailto:deo6 at prodigy.net]
To: mathgroup at smc.vnet.net
Hi there...Wondering if someone could help me with the following
issue:
I would like to change ONLY the color of the error bars produced by
the function MultipleListPlot. The standard answer is to do something
like
myerrorbar[{x_, y_}, ErrorBar[{0, 0}, {yminus_, yplus_}]] := {Red,
Line[{{x, y + yminus}, {x, y + yplus}}]}
(See post with subject line "Multiplelistplot question" for details.)
For my purposes this answer is incomplete because it doesn't reproduce
the serifs (little lines above and below the error bar). There must
be a better way to get the default serifs than to reproduce the work
that the creators of the package went through to make the serifs.
What I would like to know is how to determine what the default error
bar function is so that I can simply add the RGB[1, 0, 0] directive to
it and have the serifs and all other aspects of the error bars
unchanged (except for the color).
Any ideas how to do this? Any help would be very much appreciated.
Sincerely,
David
deo6 at prodigy.net
Prev by Date:
**Re: vector integral**
Next by Date:
**How to creat this 8×8 images**
Previous by thread:
**Changing ErrorBar colors but keeping serifs**
Next by thread:
**Re: Combinations**
| |