Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.

Re: plotting multiple time-series in different colors

Hi Brad,

> I have several time-series, each with identical domains and FunctionTypes 
> (time --> value) that I would like to plot overlayed on the same graph.  To 
> distinguish the lines I would like to have them be different colors.  
> Currently I'm able to plot the series' on the same graph, but since I'm using 
> the same ScalarMap for every time-series each line has the same color.  Is 
> there any way to map the colors in such a way that I can get each line to be 
> displayed in a different color without defining new FunctionTypes for each 
> time-series (which would seem wasteful and not strictly speaking correct).  
> Also, I want to be able to add a time-series dynamically to an existing plot; 
> i.e
> 
> addSeries(double[] data, Color color)
> 
> and have the new line plotted on the graph in the desired color.  How can I 
> accomplish this without adding new ScalarMaps to the display (which causes an 
> exception)?

Try linking each time series to the DisplayImpl via its own
DataReference and its own call to:

  addReference(DataReference ref, ConstantMap[] constant_maps)

You can define a different color for each time series by
passing ConstantMaps to Display.Red, Display.Green and
Display.Blue.

Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html


  • 2001 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: