PDA

View Full Version : Background color



green12
03-31-2009, 05:09 PM
I am trying to change the background color of my plot area. The help function instructs me to do this:

Plot, y, x, background= 255, color=0

for a white background and black data.

Yet I get a red background and black data.

Can anyone see what I am doing wrong or simply tell me the correct way to get a white background area?

thank you.

green12
03-31-2009, 05:51 PM
i need to change my device to 8-bit color don't I?

brian
03-31-2009, 06:28 PM
Hello green12,

Use INFO, /Device to list your graphics device settings. You should get Information such as:

Number of Colors: 16777216 Available

This would be consistent with 24 bit color and likely the default for your graphics device. If you wish to maintain this color resolution simply use the WoColorConvert(long) function:


WoColorConvert - Convert from a long RGB value to an index into the current color table, or from an index in the current color table to an RGB value.

Ex:


x=DINDGEN(100)
y=SIN(x/5)
PLOT, x, y, Background=WoColorConvert(255), Color=WoColorConvert(0)


You can also switch between device settings using the DEVICE procedure utilizing appropriate keywords:



DEVICE, Pseudo_color=8
INFO, /Device
...
Number of Colors: 256 Available

DEVICE, True_color=24
INFO, /Device
...
Number of Colors: 16777216 Available


Hope this helps.

Regards,

brian

green12
04-08-2009, 11:08 PM
SO I am getting the results I want except I would like my axis to be black but they continue to be red. ANy thoughts?


WSET, 4
TEK_COLOR
!P.Color=WoColorConvert(0)
PLOT, bcl, pixelsEven,YTitle = 'APD (msec)', XTitle= 'BCL (msec)', Title= 'Pixel: APD vs. BCL (pixel)', Psym = 1, Background=WoColorConvert(1), Color=WoColorConvert(2)
OPLOT, bcl, pixelsOdd, Psym = 2, Color=WoColorConvert(4)
END

fik
04-09-2009, 04:07 AM
green12,

Simple solution is to use a /Nodata keyword, which can be used to draw an empty set of axes between some given values of your data set and then you can over-plot what ever you want.



PLOT, [XMIN, XMAX], [YMIN, YMAX], /Nodata


Here is a simple example




PRO Nodata_example
x = DINDGEN(100)
y1 = SIN(x/5)
y2 = COS(x/5)
PLOT, Background=WoColorConvert(1), [0,100],[-1,1], $
Title = 'using Nodata keyword',$
XTitle = 'degrees', YTitle = 'sin(x) , cos(x)', /Nodata
OPLOT, x, y1, Color=WoColorConvert(2) & OPLOT, x, y2, Color=WoColorConvert(4)
END



Fik

hcrisp
04-09-2009, 08:40 AM
green12, note that you are specifying the first curve and axes to be red. If you want black, use index 0 instead of index 2 (see color palette).



tek_color
color_palette
; notice that index 0 is black, index 2 is red
...
PLOT, bcl, pixelsEven, Psym=1, $
Background=WoColorConvert(1), Color=WoColorConvert(0)


However, if you want black axes, red first curve, and blue second curve, then you will have to use fik's method.