X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 13 Dec 2016 09:41 AM by  anon
COORD_TRANSFORM question
 0 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



Basic Member


Posts:143
Basic Member


--
13 Dec 2016 09:41 AM
    A user has asked the following question: Question : ---------- I need to create a log-log plot of power spectra in IDL. The bottom x-axis should be wavenumber and the top axis should be wavelength. My approach so far has been to use the plot function like this: p2=plot(wavenumber,spectrum,xtitle='Wavenumber (1/m)',xlog=1,ylog=1,AXIS_STYLE=1) and then construct the top wavelength axis using the axis function. However, wavelength is the reciprocal of wavenumber and I don't know how to do that in the COORD_TRANSFORM argument for the axis command.Can someone advise me on how to get this done? Possible answer: The COORD_TRANSFORM keyword only makes linear changes to the axis. Therefore, I don't think it can be used in this case. However, you might be able to use the TICKNAMES (the lable on the tick) and TICKVALUES (the actual value the tick is located) keywords to do accomplish this task. For example: IDL> j = findgen(100) + 1 IDL> f = findgen(100) + 1 IDL> k = 1/f IDL> p = plot(j,f, axis_style=1) IDL> max_k = max(k, min=min_k) IDL> range_k = max_k - min_k IDL> indices = [0, 24, 49, 74, 99] IDL> j_values = j[indices] IDL> k_names = strtrim(k[indices],2) IDL> a = axis('x', location='top', tickvalues=j_values, tickname=k_names)
    You are not authorized to post a reply.