Re: colorbar help [message #9986] |
Wed, 01 October 1997 00:00 |
R. Bauer
Messages: 137 Registered: November 1996
|
Senior Member |
|
|
Rick McDaniel wrote:
>
> Does IDL have a generic procedure to output a colorbar on a contour plot?
>
> I found a procedure on the web, and it works great when device is set to
> the display but it doesn't look the same when device is set to PS. Here's
> my procedure to read in a data file, call a procedure to calculate the
> wavelet transform, and plot the results:
>
> ************************************************************ ********************
> READCOL, 'oct30.dat', time1, data ; reads in the data file
> wave = WAVELET(data,0.0155,PERIOD=period,COI=coi,/PAD,SIGNIF=signif ,SCALE=scale)
> freq = 6/(scale)
> LOADCT,39
>
> !P.font = 0 ;i want hardware fonts
>
> mydevice = !D.NAME
> set_plot, 'PS'
>
> device, filename = 'oct30.ps', /COLOR, /inches
>
> CONTOUR,ABS(wave)^2,time1,freq,xtickformat='xticks',$
> XSTYLE=1,XTITLE='Time',YTITLE='Frequency (Hz)', $
> TITLE='Oct30 Wavelet Power Spectrum',YRANGE=[MIN(freq), 10], $
> pos = [0.2, 0.2, 0.9, 0.9], /YLOG, YSTYLE=1, NLEVELS=25,/FILL
>
> dispbar,250,10,200,5,/Border ; display the color bar, see below
>
> device, /close
>
> set_plot, mydevice
> ************************************************************ ********************
>
> Here's the procedure to display the colorbar:
>
> ************************************************************ ********************
> pro dispbar,cbllx,cblly,cbx,cby,Border=Border
> ;+
> ; NAME:
> ; DISPBAR
> ; DESCRIPTION:
> ; This procedure creates and displays a color bar on the screen.
> ; CALLING SEQUENCE:
> ; DISPBAR,cbllx,cblly,cbx,cby,Border=Border,Vertical=Vertical
> ; INPUT:
> ; CBLLX Color Bar Lower Left hand X coordinate
> ; CBLLY Color Bar Lower left hand Y coordinate
> ; CBX Color Bar X length
> ; CBY Color Bar Y height
> ; OUTPUT:
> ; Screen output only. All passed variables remain unchanged.
> ; OPTIONAL FLAGS:
> ; BORDER Puts a white (BLACK in PS) border around the color bar.
> ; HISTORY:
> ; 30-MAY-90 Version 1 written by Eric W. Deutsch
> ; 24-AUG-91 Added /Border Keyword (E. Deutsch)
> ;-
>
> if (n_params(0) lt 4) then begin
> print,'Call: IDL> DISPBAR,lwrlft_X,lwrlft_Y,X_length,Y_height,[/Border]'
> print,'e.g.: IDL> dispbar,120,30,100,10,/Border'
> return
> endif
>
> if (n_elements(Border) eq 0) then Border=0
>
> if (cby eq 0) or (cbx eq 0) then return
>
> bar=byte(indgen(cbx)*(!d.n_colors*1./cbx<255))
>
> for i=0,cby-1 do tv,bar,cbllx,cblly+i
>
> if (Border eq 1) then plots,[cbllx,cbllx+cbx,cbllx+cbx,cbllx,cbllx], $
> [cblly,cblly,cblly+cby-1,cblly+cby-1,cblly],/device
>
> return
> end
> ************************************************************ ********************
>
> Any help appreciated.
>
> Rick McDaniel
The problem whith this routine is:
a) it uses tv to display a colorbar
that's not good because contours are done by something like plots
and ployfill
To get best results you should use routines which did the colorbar
in the same way as contours are done.
I have one but it's in the moment in building phase (beta).
b) Your colorbar could not be used to print the right levels if nlevels
was used.
c) to print tv ed data you have to open the device whith
bits_per_pixel=8. If you don't you'll will get in the most cases grey
to black colorbars.
--
R.Bauer
Institut fuer Stratosphaerische Chemie (ICG-1)
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
|
|
|
Re: colorbar help [message #9992 is a reply to message #9986] |
Tue, 30 September 1997 00:00  |
Martin Schultz
Messages: 515 Registered: August 1997
|
Senior Member |
|
|
Rick McDaniel wrote:
>
> Does IDL have a generic procedure to output a colorbar on a contour plot?
>
> I found a procedure on the web, and it works great when device is set to
> the display but it doesn't look the same when device is set to PS. Here's
> my procedure to read in a data file, call a procedure to calculate the
> wavelet transform, and plot the results:
>
(cut)
I was facing the same problem, and I ended up editing my colortable so
that I get 10 contour levels with easily distinguishable and more or
less
"intuitive" colors. I put a routine named mapct.pro on my webpage and
there
is also a somewhat rudimentary version of a routine named
getcontourlevels.pro
which serves to determine the cuts between the 10 levels. Sorry, but at
this stage I am still developing the rest of the routines needed to do
the actual contourplots with these routines.
Anyhow, I got another question concerning a related issue:
I discovered that (at least with our color printer which is a QMS
magicolor CX) a decrease in the RGB levels does not necessarily lead to
darker colors but may actually yield brighter ones. Furthermore, it is
quite hard to find RGB values that are not dithered on this printer
(although I am using bits_per_pixel=8). So, I wonder whether this is a
general problem of postscript or IDL or a specific problem of our
printer.
Thanks for any help,
Martin.
------------------------------------------------------------ ------------
Dr. Martin Schultz
Department for Earth&Planetary Sciences, Harvard University
186 Pierce Hall, 29 Oxford St., Cambridge, MA-02138, USA
phone: (617)-496-8318
fax : (617)-495-9837
Please indicate name and room (186 Pierce) when sending a fax
mailto:mgs@io.harvard.edu
IDL-homepage: http://www-as.harvard.edu/people/staff/mgs/idl/
------------------------------------------------------------ ------------
|
|
|