comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Plotting with colorbar
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Plotting with colorbar [message #87214 is a reply to message #87213] Thu, 16 January 2014 08:37 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Madhavan Bomidi writes:

> I have a data matrix with 99 columns and 86400 rows (each row
represents time in seconds). The whole of the data matrix is arranged
with only 5 numbers = [-9, 1, 2, 3, 4]. I wanted to make a color bar
with 4 colors = ['DARK RED','RED','SKY BLUE', 'BLUE'] representing
numbers [1, 2, 3, 4] respectively and -9 represents a missing value
(assigned 'WHITE' color)
>
> Below are my lines in the code for synthetic data:
>
> time=LINDGEN(86400) ; in seconds
>
> tmp_data=REPMAT([-9,1,2,3,4],20,86400)
> data=tmp_data[0:98,*]
>
> missingIndices=WHERE(data EQ -9, missingCount)
> IF missingCount GT 0 THEN data[missingIndices]=0

The following command is unnecessary.

> img=BytScl(data,MIN=0,MAX=4,/NAN)

It probably doesn't hurt anything, but you could do just as well with
this command:

img = Byte(data)

> TVLCT, cgColor('WHITE',/Triple),0 ; Background color
> TVLCT, cgColor(['DARK RED','RED','SKY BLUE','BLUE'],/Triple),1
>
> ???
> ???
>
> Now my problem is ... I want X-axis with time, Y-axis with data column indices (i.e., indgen(99)) where I wanted to place colored dots (basing on the colorbar) for each of the data point column wise for all the time points. Can anyone suggest me how shall I proceed after the above steps in simplest way?

You don't want colored dots. Putting them on your plot will take weeks,
if not longer. And, unless you are making your plot the size of a
building, you wouldn't see individual dots anyway. :-)

Try this:

time=LINDGEN(86400) ; in seconds
tmp_data=REPMAT([-9,1,2,3,4],20,86400)
data=tmp_data[0:98,*]
missingIndices=WHERE(data EQ -9, missingCount)
IF missingCount GT 0 THEN data[missingIndices]=0
img=Byte(data)
TVLCT, cgColor('WHITE',/Triple),0 ; Background color
TVLCT, cgColor(['DARK RED','RED','SKY BLUE','BLUE'],/Triple),1
cgimage, Transpose(data), /axes, axkeyword={xtitle:'Time'}
END

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Maps - ellipsoids in map_set ('scale on the central meridian')
Next Topic: averaging w.r.t time resolution

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 21:34:48 PDT 2025

Total time taken to generate the page: 0.31527 seconds