Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specifying sequence of colors in ListPlot

I am trying to figure out how to use Mathematica's color schemes with discrete data. For example, I have a list of time series in the form

s={{{1946,1},{1947,2},{1948,3}},{{1946,-2},{1947,-1.8}}}

and so on; there are about 30 series of varying length. If I plot/join/overlay these series using ListPlot, is there a way to instruct Mathematica to select colors for each plot by taking evenly spaced colors from a ColorFunction returned by ColorData (e.g., "Rainbow")?

How would I combine this with a directive to make each plot Thick?

ListPlot[s,Joined->True,PlotStyle->{Thick,???}]
like image 351
mfvonh Avatar asked Dec 05 '12 21:12

mfvonh


1 Answers

Imagine this is your data - a ragged list of 30 lists of varied length:

data = Table[.5 k + RandomReal[1, RandomInteger[{8, 14}]], {k, 30}];

Is it what you need?

ListPlot[data, Joined -> True, 
         PlotStyle -> Thread@{Thick, ColorData["Rainbow"] /@ Range[0, 1, 1/29]}]

enter image description here

like image 183
Vitaliy Kaurov Avatar answered Oct 07 '22 15:10

Vitaliy Kaurov