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,???}]
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]}]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With