Re: Easy colours? [message #82072 is a reply to message #82069] |
Thu, 15 November 2012 16:44   |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
markjamie@gmail.com writes:
> I often find myself needing to plot graphs (in direct or new graphics) for an unknown number of data series. To differentiate between them in the plot I colour each line / symbols. Since most of the time I have less than 10 series I usually just define an array of 10 specific colours and select from this on the plot command. However, this method has problems if you breach the number of pre-defined colours.
>
> Ideally, I'd like to be able to load a colour table and then have an easy way to select 'x' equally spaced colours across the colour table.
>
> For example, if my colour table went from blue-yellow-pink-green-red and I had 5 data series, I would like to be able to access each colour using a fractional number specifying how far across th colour table
>
> E.g.
> Loadct,39
> Plot, Series1, color=mycolour(0)
> OPlot,Series2, color= mycolour(0.25)
> OPlot,series3, color=mycolour(0.5)
> OPlot,series4, color=mycolour(0.75)
> OPlot,series5,color=mycolour(1)
>
> I've never found a way to do this in IDL - perhaps I'm missing something really simple...
Loadct, 39, NCOLORS=NumberInSeries, BOTTOM=1
mycolour = Bindgen(NumberInSeries)+1
You might prefer to use cgLoadCT instead, since it has a
CLIP keyword that is useful for trimming off colors at
one or both ends of the color table before selecting
the equally spaced colors.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
|
|
|