Re: inconsistent synatx for FillingStyle and PlotStyle?
- To: mathgroup at smc.vnet.net
- Subject: [mg103165] Re: [mg103115] inconsistent synatx for FillingStyle and PlotStyle?
- From: Bob Hanlon <hanlonr at cox.net>
- Date: Wed, 9 Sep 2009 04:47:19 -0400 (EDT)
- Reply-to: hanlonr at cox.net
If all else fails, hit it with a hammer. pts = {{1, 1}, {2, 3}}; colors = {Red, Blue}; Show[ListPlot[{#[[2]]}, PlotStyle -> #[[1]], Filling -> Axis, FillingStyle -> Lighter[#[[1]]]] & /@ Transpose[{colors, pts}], PlotRange -> All] ListPlot[List /@ pts, PlotStyle -> colors, AxesOrigin -> {0, 0}, Epilog -> ( {#[[1]], Line[{#[[2]], {#[[2, 1]], 0}}]} & /@ Transpose[{colors, pts}])] Or from primitives Graphics[{{#[[1]], Point[#[[2]]], Line[{#[[2]], {#[[2, 1]], 0}}]} & /@ Transpose[{colors, pts}]}, Axes -> True, AxesOrigin -> {0, 0}, AspectRatio -> 1/GoldenRatio] Bob Hanlon ---- Nasser Abbasi <nma at 12000.org> wrote: ============= Problem: Make a ListPlot, and have each Point be a different color. Solution: Use Directive ListPlot[{{{1, 1}}, {{2, 3}}}, PlotStyle -> {Directive[Red], Directive[Blue]}, AxesOrigin -> {0, 0}] Problem : Make a ListPlot, but with vertical lines, and have each line be a different color. You would expect the synatx to be the same as above, just use Filling->Axis and use FillingStyle-> insteadl of PlotStyle->, right? But it does not work Solution attempt: ListPlot[{{{1, 1}}, {{2, 3}}}, Filling -> Axis, FillingStyle -> {Directive[Red], Directive[Blue]}, AxesOrigin -> {0, 0}] Now I looked at help, and it says: "Directives can be combined using Directive[g1,g2,....]" So, I tried this ListPlot[{{{1, 1}}, {{2, 3}}}, Filling -> Axis, FillingStyle -> Directive[Red, Blue], AxesOrigin -> {0, 0}] And this did not work either. I also tried ListPlot[{{{1, 1}}, {{2, 3}}}, FillingStyle -> {Red, Blue}, AxesOrigin -> {0, 0}, Filling -> Axis] I also tried ListPlot[{{{1, 1}}, {{2, 3}}}, FillingStyle -> Directive[{Red, Blue}], AxesOrigin -> {0, 0}, Filling -> Axis] Am I getting any closer? I tried above 10 other ways, and can't get it to do this. so I give up :) Any idea how to make each vertical line be colored differently according to my own list of colors? thanks, --Nasser