Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #15252

Re: ListLinePlot Color each line differently

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: ListLinePlot Color each line differently
Date 2013-07-26 09:43 +0000
Message-ID <kstgc6$i30$1@smc.vnet.net> (permalink)
References <20130725020507.AE8D26A43@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


data2 = Table[Accumulate[RandomReal[{-1, 1}, 250]], {3}];


blend1 = (Blend[{{0, Green}, {1, Red}}, #] &);


You are varying the color of all three lines by their x coordinates


p2 = ListLinePlot[data2,
  ColorFunction -> (blend1[#1] &),
  ImageSize -> 500,
  Background -> None,
  PlotStyle -> Thickness[0.0025]]


To color all three lines by their y coordinates use


p2 = ListLinePlot[data2,
  ColorFunction -> (blend1[#2] &),
  ImageSize -> 500,
  Background -> None,
  PlotStyle -> Thickness[0.0025]]


To apply a separate color to each line, use PlotStyle


p2 = With[{nmax = Length[data2] - 1},
  ListLinePlot[data2,
   ImageSize -> 500,
   Background -> None,
   PlotStyle -> Table[
     {blend1[n/nmax], Thickness[0.0025]},
     {n, 0, nmax}]]]



Bob Hanlon




On Wed, Jul 24, 2013 at 10:05 PM, <kuzumadam@gmail.com> wrote:

> Hi, I have a line plot made from an imported .xlsx file. I have made my
> own color blend and want to color each line differently according to this
> blend - how do I do this? Currently my blend will only work across the x or
> z axis.
>
> data2 = Import["SAXS_SIM_EDR10_23JUL.xlsx"]
>
> blend1 = (Blend[{{0, Green}, {1, Red}}, #] &);
> Graphics[Table[{blend1[x], Disk[{8 (x + 1), 0}]}, {x, 0, 1, 1/8}]]
>
> p2 = ListLinePlot[data2, PlotRange -> {{0, 0.7}, {-1, -5}},
>   ColorFunction -> (blend1[#1] &), ImageSize -> 500,
>   Background -> None, PlotStyle -> Thickness[0.0025]]
>
> Thanks in advance,
> Toni
>
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: ListLinePlot Color each line differently Bob Hanlon <hanlonr357@gmail.com> - 2013-07-26 09:43 +0000

csiph-web