Re: imcontour no longer plotting in color [message #81017] |
Thu, 02 August 2012 20:27 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Balthasar Indermuehle writes:
> Thanks Dave, I changed it to OVERPLOT, then TYPE is not a valid keyword, removed that, and then the dimensions in the supplied data arrays don't agree or so it seems to think. Funny how the dimensions are fine for IMCONTOUR.
>
> I have uploaded the project including its data as well as the contents of my ~/IDL directory (because you need the GSFC astronomy libraries and some more (older) functions) in case you want to try it. Download the code with data from here: http://dropbox.inside.net/
>
> colorprob.zip contains code and data
> IDL_Libs.zip contains my ~/IDL directory.
>
> Many thanks if you have a look at this!
Well, I like to make sure the levels on the contour
plot match the levels on the color bar. Otherwise,
I think I am working with Function Graphics. ;-)
That's the only real change I made. I've e-mailed
the updated file to you.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: imcontour no longer plotting in color [message #81019 is a reply to message #81017] |
Thu, 02 August 2012 18:23  |
Balthasar Indermuehle
Messages: 22 Registered: August 2012
|
Junior Member |
|
|
Hi David,
Your first message only just came through, perils of usenet I guess...
Indeed running cgLoadCT twice, the second time without the RGB_Table keyword seems to have solved the problem.
If you're up for it, I'd still appreciate you (or anyone else for that matter) having a look over the code I just uploaded. I suspect there are a number of unnecessary calls in there that might be better replaced by some of your latest CG calls? I for instance just saw that I'm using the TVLCT call in the beginning, which serves no purpose any longer?
Many thanks!
- Balt
> I don't use IMCONTOUR, but I notice you are trying to pass
>
> it the colors to use via a PALETTE keyword. I don't have
>
> a PALETTE keyword defined for my IMCONTOUR program, so
>
> unless you have added one, this is probably the source
>
> of the error.
>
>
>
> When you call cgLoadCT, you use the RGB_TABLE keyword
>
> to create the palette. No colors are loaded in the
>
> hardware color table when this keyword is used.
>
>
>
> I would try adding a second cgLoadCT command below
>
> the first (assuming you are creating the palette
>
> for a reason), and remove the RGB_TABLE keyword
>
> on this call.
>
>
>
> Does that make a difference?
>
>
>
> Cheers,
>
>
>
> David
>
>
>
> --
>
> David Fanning, Ph.D.
>
> Fanning Software Consulting, Inc.
>
> Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
>
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: imcontour no longer plotting in color [message #81020 is a reply to message #81019] |
Thu, 02 August 2012 17:59  |
Balthasar Indermuehle
Messages: 22 Registered: August 2012
|
Junior Member |
|
|
Thanks Dave, I changed it to OVERPLOT, then TYPE is not a valid keyword, removed that, and then the dimensions in the supplied data arrays don't agree or so it seems to think. Funny how the dimensions are fine for IMCONTOUR.
I have uploaded the project including its data as well as the contents of my ~/IDL directory (because you need the GSFC astronomy libraries and some more (older) functions) in case you want to try it. Download the code with data from here: http://dropbox.inside.net/
colorprob.zip contains code and data
IDL_Libs.zip contains my ~/IDL directory.
Many thanks if you have a look at this!
Cheers
- Balt
|
|
|
Re: imcontour no longer plotting in color [message #81023 is a reply to message #81020] |
Thu, 02 August 2012 06:47  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Balthasar Indermuehle writes:
> I'm using IMCONTOUR twice. The first time it draws the FITS data and grid, the second call draws the contours. Replacing the second call with CGCONTOUR works as well, i.e. same outcome as using IMCONTOUR. The first call however, if I change it to CGCONTOUR, an error window pops up:
>
> CGCOLOR--> Attempt to subscript RVALUE with THEINDEX is out of range.
Hard to know what is going on here without seeing the
error traceback.
>
> and then immediately a second error:
>
> CGCONTOUR--> Keyword OVERLAY not allowed in call to: CONTOUR
Change OVERLAY to OVERPLOT.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: imcontour no longer plotting in color [message #81025 is a reply to message #81023] |
Thu, 02 August 2012 06:34  |
Balthasar Indermuehle
Messages: 22 Registered: August 2012
|
Junior Member |
|
|
Hi Wayne,
many thanks for your reply. The colourtable variable is defined here:
colourtable = 22 ; Which colour table to use. Some colours are (descriptions are for Brewer colour schemes, in reverse):
; 0: dark green to white
; 1: dark blue - turquoise - eggshell
; 2: light blue - turquoise - eggshell
; 3: dark green to white
; 4: dark green - blue - white
; 5: dark blue to white
; 6: purple to white
; 7: purple - eggshell - white
; 8: red - pink - white
; 9: red - white
; 10: brown - orange - eggshell
; 11: red - orange - eggshell
; 12: purple - white
; 13: blue - white
; 14: green - white
; 15: red - orange - white
; 17: black - white
; 18: purple - white - brown
; 19: green - white - brown
; 20: green - white - purple
; 21: light green - white - purple
; 22: blue - white - red
; 23: black - white - red
; 24: light blue - white - red
; 25: light blue - eggshell - red
; 26: light green - eggshell - red
; 27: orange - green - purple
; 28: white - orange - blue - green - black
I'm using IMCONTOUR twice. The first time it draws the FITS data and grid, the second call draws the contours. Replacing the second call with CGCONTOUR works as well, i.e. same outcome as using IMCONTOUR. The first call however, if I change it to CGCONTOUR, an error window pops up:
CGCOLOR--> Attempt to subscript RVALUE with THEINDEX is out of range.
and then immediately a second error:
CGCONTOUR--> Keyword OVERLAY not allowed in call to: CONTOUR
Cheers
- Balt
|
|
|
Re: imcontour no longer plotting in color [message #81026 is a reply to message #81025] |
Thu, 02 August 2012 05:08  |
wlandsman
Messages: 743 Registered: June 2000
|
Senior Member |
|
|
Since you are mostly using Coyote graphics (CGLoadCt, IMCONTOUR), I would also use CGCONTOUR rather than CONTOUR. That likely isn't the main problem, but it might be contributing. You also might want to use PS_START and PS_END
It would also be useful to know the value of the variable 'colourtable'.
I've never used the PALETTE keyword but I'd think you'd want it in both the IMCONTOUR and (CG)CONTOUR commands, since it looks like you are only using IMCONTOUR to set up the axes, and actually drawing with (CG)CONTOUR.
Just some quick thoughts. --Wayne
On Thursday, August 2, 2012 6:16:58 AM UTC-4, Balthasar Indermuehle wrote:
> To add some more information... Here's how the plotting goes, can anyone see a flaw in this? the result is a plot in black and white with contours drawn correctly, and the colorbar in color!
>
>
>
> Setting things up:
>
>
>
> !p.multi = [0, 1, 1 ] ; plot 1 x 1 plots on one sheet. Set to 0, 2, 2 if you want 2 x 2 plots for example
>
> SET_PLOT, 'PS'
>
> DEVICE, filename=fname, XSIZE=22, YSIZE=22, /COLOR, BITS=8, /ENCAPSULATED, FONT_SIZE=8
>
> TVLCT, INDGEN(256), INDGEN(256), INDGEN(256)
>
>
>
> Load the colour table:
>
>
>
> cgLoadCT, colourtable, RGB_Table=pal, CLIP=[1, MAX(data_map)/MAX(data_map)*255], /BREWER, /REVERSE
>
>
>
>
>
> IMCONTOUR, data_map, HDR_MOM, TITLE=title, NLEVELS=num_colours, /FILL, POSITION=pos, PALETTE=pal, TYPE=1, CHARSIZE=1, /OVERLAY
>
>
>
> ; add contours
>
> CONTOUR, data_map, x, y, levels=FINDGEN(num_cont) * (cp / (num_cont-1.0D)) + (cp / 2), /FOLLOW, /OVERPLOT
>
>
>
> plot the colour bar
>
> pos=[0.92, 0.1, 0.94, 0.9]
>
> cgColorbar, Title=title, Divisions=12, NColors=num_colours, $
>
> Range=[MIN(data_map),MAX(data_map)], TickLen=1.0, POSITION=pos, Charsize=1, $
>
> PALETTE=pal, /VERTICAL, /RIGHT, FORMAT='(D0.2)'
|
|
|
Re: imcontour no longer plotting in color [message #81027 is a reply to message #81026] |
Thu, 02 August 2012 05:02  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Balthasar Indermuehle writes:
> I'm in what looks to be a veritable mess... my calls to imcontour to plot a FITS image no longer work with colour palettes, it just draws b/w. The legend however drawn with cgColorbar appear nice and normal in colour on the same piece of postscript, so it's obviously not a device problem.
>
> This is running from a piece of code that worked about a year ago, apart from updating from 10.6 to 10.7 (OS X obviously) there have been no changes to the system I'm aware of, certainly not in the IDL realm.
>
> Anyone have any clue where to even start looking!?
I don't use IMCONTOUR, but I notice you are trying to pass
it the colors to use via a PALETTE keyword. I don't have
a PALETTE keyword defined for my IMCONTOUR program, so
unless you have added one, this is probably the source
of the error.
When you call cgLoadCT, you use the RGB_TABLE keyword
to create the palette. No colors are loaded in the
hardware color table when this keyword is used.
I would try adding a second cgLoadCT command below
the first (assuming you are creating the palette
for a reason), and remove the RGB_TABLE keyword
on this call.
Does that make a difference?
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|
Re: imcontour no longer plotting in color [message #81028 is a reply to message #81027] |
Thu, 02 August 2012 03:16  |
Balthasar Indermuehle
Messages: 22 Registered: August 2012
|
Junior Member |
|
|
To add some more information... Here's how the plotting goes, can anyone see a flaw in this? the result is a plot in black and white with contours drawn correctly, and the colorbar in color!
Setting things up:
!p.multi = [0, 1, 1 ] ; plot 1 x 1 plots on one sheet. Set to 0, 2, 2 if you want 2 x 2 plots for example
SET_PLOT, 'PS'
DEVICE, filename=fname, XSIZE=22, YSIZE=22, /COLOR, BITS=8, /ENCAPSULATED, FONT_SIZE=8
TVLCT, INDGEN(256), INDGEN(256), INDGEN(256)
Load the colour table:
cgLoadCT, colourtable, RGB_Table=pal, CLIP=[1, MAX(data_map)/MAX(data_map)*255], /BREWER, /REVERSE
IMCONTOUR, data_map, HDR_MOM, TITLE=title, NLEVELS=num_colours, /FILL, POSITION=pos, PALETTE=pal, TYPE=1, CHARSIZE=1, /OVERLAY
; add contours
CONTOUR, data_map, x, y, levels=FINDGEN(num_cont) * (cp / (num_cont-1.0D)) + (cp / 2), /FOLLOW, /OVERPLOT
plot the colour bar
pos=[0.92, 0.1, 0.94, 0.9]
cgColorbar, Title=title, Divisions=12, NColors=num_colours, $
Range=[MIN(data_map),MAX(data_map)], TickLen=1.0, POSITION=pos, Charsize=1, $
PALETTE=pal, /VERTICAL, /RIGHT, FORMAT='(D0.2)'
|
|
|