X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 09 Aug 2013 09:30 AM by  anon
Adding color using Image()
 3 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
09 Aug 2013 09:30 AM
    Hi, I have a 2-d histogram that I am plotting using im1=IMAGE(hist, ...). Is there a way to add color to the image so the histogram is colored rather than black&white? I've tried things like color=color, /color, n_colors etc. but haven't had any luck. (as a side note I can't seem to get background_color to work either...) I can get a color plot using the older image command. imdisp,hist, .... SET_PLOT, 'PS' loadct,9 DEVICE, FILE='24bit.ps', /COLOR, BITS=8 imdisp,hist,xtitle='Stellar mass',ytitle='u-r',xrange=xr,yrange=yr DEVICE, /CLOSE But the image quality isn't great and I'm having issues getting things like contours to overplot on the image with this method - sometimes it works and sometimes it doesn't. It's driving me nuts. I can easily get the image to look the way I want it to with im=image(hist, ...) and overplotting any contours with the exception of the color. Any suggestions? I realize that I threw a few issues in here, but I'm really more concerned with getting the image to show in color than anything else. Thanks

    Berangere Casson



    New Member


    Posts:61
    New Member


    --
    12 Aug 2013 08:49 AM
    You can add color when displaying an image with the IMAGE function using the RGB_TBLE keyword For example: file = FILEPATH('nyny.dat', $ SUBDIRECTORY = ['examples', 'data']) nyny = READ_BINARY(file, DATA_DIMS = [768, 512]) ; Display the image using the IMAGE function im = IMAGE(nyny, RGB_TABLE=36)

    Deleted User



    New Member


    Posts:
    New Member


    --
    12 Aug 2013 10:32 AM
    Thanks so much! You wouldn't happen to know how to change the background color to white, would you? I'm not having any luck with BACKGROUND_COLOR or BACKGROUND_TRANSPARENCY. I've tried: BACKGROUND_COLOR='w' and ='white' and =[255,255,255] BACKGROUND_TRANSPARENCY= 90 and nothing has changed. Cheers

    Berangere Casson



    New Member


    Posts:61
    New Member


    --
    13 Aug 2013 08:43 AM
    Background color is usually white by default. Please find below an example showing how to change to red for example: file = FILEPATH('nyny.dat', $ SUBDIRECTORY = ['examples', 'data']) nyny = READ_BINARY(file, DATA_DIMS = [768, 512]) im = IMAGE(nyny, RGB_TABLE=36) im.GetProperty,window=owin owin.SetProperty,background_color='red'
    You are not authorized to post a reply.