Controling the color of line segments in a Log plot
- To: mathgroup at smc.vnet.net
- Subject: [mg90127] Controling the color of line segments in a Log plot
- From: Donald DuBois <donabc at comcast.net>
- Date: Mon, 30 Jun 2008 04:51:58 -0400 (EDT)
I would like to control the color of line segments in a Log plot. I have three Questions (A,B,C) regarding this problem. A simple example: I start with the data yValues = Table[10^n, {n,10}] - which should also be the Y-axis tick values - and use ListLogPlot to graph it. yValues = Table[10^n, {n, 10}] xy = Transpose[{Range[Length[yValues]], yValues}] ListLogPlot[xy, Joined -> True] Question A . Does anyone find it peculiar that ListLogPlot seems to be taking Log to base 10 as a default as in the above plot when Log by itself defaults to base E? This is FINE for me, as I want it to be to the base 10. But still, does anyone know why this is so or am I misconstruing something? Question B. I would like to change the color to Red of the line segment with X values going from 3 to 6. (In general, I would like to change the segment color to Red for any number of segments of the same Log plot.) Is there a way to do this at the ListLogPlot level (i.e.giving directives directly to ListLogPlot)? That would be the simplest solution. I can change the color of this part of the graph by going down to the Graphics element level using Line as in the following, but this is tedious. logY = Map[N[ Log[10, #]] &, yValues] xyLog = Transpose[{Range[Length[logY]], logY}] l2 = Graphics[{Red, Thick, Line[Take[xyLog, {3, 6}]]}]; l1 = Graphics[{Line[Take[xyLog, {1, 3}]]}]; l3 = Graphics[{Line[Take[xyLog, {6, 10}]]}]; Show[l1, l2, l3, Axes -> True, AxesOrigin -> {0, 0}] Question C. The above graph loses the original Y axis tick values which are contained in the yValues list defined above. Is there any way to solve this? I want the graph to look like the first graph above with the same Y tick values (using ListLogPlot) except the Line segment with X values from 3 to 6 should be Red. Thank you in advance for any help you can give me. Don