[Date Index]
[Thread Index]
[Author Index]
Re: Controling the color of line segments in a Log plot
*To*: mathgroup at smc.vnet.net
*Subject*: [mg90209] Re: Controling the color of line segments in a Log plot
*From*: Donald DuBois <donabc at comcast.net>
*Date*: Wed, 2 Jul 2008 05:31:15 -0400 (EDT)
David Park wrote:
"One might have hoped that the following construction would work:
ListLogPlot[xy, Joined -> True,
ColorFunction -> Function[{x, y}, If[3 <= x <= 6, Red, Black]]]
But it doesn't. Perhaps someone will know how to make that approach work."
It appears that, following Bob Hanlon's approach,
ColorFunctionScaling -> False is needed as in:
yValues = Table[10^n, {n, 10}]
xy = Transpose[{Range[Length[yValues]], yValues}]
ListLogPlot[xy, Joined -> True,
ColorFunction -> Function[{x, y}, If[3 <= x <= 6, Red, Black]],
ColorFunctionScaling -> False]
ColorFuncttionScaling is, by default, set to True which assumes the x values are in the Range [0,1]. See
Documention Center for more details. The above approach can be expanded to include multiple ranges of x values:
ListLogPlot[xy, Joined -> True,
ColorFunction ->
Function[{x, y}, If[3 <= x <= 6 || 8 <= x <= 8
|| 1 <= x <= 1 , Red, Blue]],
ColorFunctionScaling -> False]
I am still evaluating which is the best way to go to get the correct tick marks etc. I appreciate all the responses. Thank you.
Prev by Date:
**Re: For loop problem in mathematica**
Next by Date:
**Fw : Re: Happy Birthday Mathematica!**
Previous by thread:
**Re: Controling the color of line segments in a Log plot**
Next by thread:
**Jump to Page Mathematica Book**
| |