X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 03 Mar 2022 10:21 AM by  Ben Castellani
Plot transparency issue IDL8.8.2
 1 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Wouter Schellekens



New Member


Posts:20
New Member


--
02 Mar 2022 03:56 AM
    Hi IDL experts,

    When I plot symbols with the plot or scatterplot function, the transparency of the symbols is high. I cannot get it to zero, and appears to be transparency=50 by default. I can increase it to values higher than transparency=50. However, the issue only occurs when displaying within IDL and not when I save it to e.g. a png-file.
    I'd like to see my figures exactly as I would save them, so I'd know what I'm saving. How can I fix this?
    I'm using IDL8.8.2 on Linux Debian 11

    Thanks!
    Wouter

    Ben Castellani



    Basic Member


    Posts:130
    Basic Member


    --
    03 Mar 2022 10:21 AM
    There is a known bug with IDL 8.8.x on Mac & Linux systems which affects on-screen rendering. Some things impacted include transparency, anti-aliasing, and zvalues (which items get drawn in front vs back).

    One thing you can try is changing between hardware and software rendering on your machine. Use this command to enable software rendering:

    PREF_SET,'IDL_GR_X_RENDERER',1,/COMMIT

    Then test your IDL code again to see if the transparency issue is resolved. If not, try hardware rendering with this:

    PREF_SET,'IDL_GR_X_RENDERER',0,/COMMIT

    If changing between hardware and software rendering does not improve the issue, as a work-around the following code path may help with visualizing your desired graphic on-screen. Basically this method plots the graphic to the off-screen buffer, saves it to disk, then reimages the file for viewing to the screen. This should display the correct transparency.

    ;BEGIN IDL PRO CODE EXAMPLE
    ; Specify the file to use for the plot.
    testFile = FILEPATH('ScatterplotData.csv', $
    SUBDIRECTORY = ['examples', 'data'])

    ; Read the file and assign it to the sed_data variable;
    ; assign the header information to variables for use later.
    sed_data = READ_CSV(testFile, HEADER=sedHeader, $
    N_TABLE_HEADER=1, TABLE_HEADER=sedTableHeader)

    ;Set transparency for points on plot
    scatTransparency=90

    ; Create the plot with x-axis:FIELD1 and y-axis:FIELD2
    dist_size = SCATTERPLOT(sed_data.FIELD1, sed_data.FIELD2, $
    SYMBOL='star', /SYM_FILLED, RGB_TABLE=7, trans=scatTransparency, $
    XTITLE='Distance from Glacier Terminus in Meters', $
    YTITLE='Mean Particle Size in Millimeters', $
    TITLE='Sediment Distribution at the Terminus of Tidewater Glaciers, AK', $
    MAGNITUDE=sed_data.FIELD3,/buffer)

    dist_size.save, 'test.png',border=20,res=200
    dist_size.close
    im = image('test.png',margin=0)

    end
    You are not authorized to post a reply.