Search code examples
plotidl-programming-language

Basic plotting in running IDL procedure


I started learning IDL a few hours ago. I have constructed the following procedure in a .pro called 'plots.pro':

PRO PLOTS
num=findgen(40)*10
line=sin(num*!DtoR)
plot, num, line
END

It seems I should get a plot of the line as a function of num. However, I instead get the following error message:

'plots ^ % PLOTS: Incorrect number of arguments.'

I wonder if you may point me in the right direction.


Solution

  • The procedure name "PLOTS" is already used by a different IDL procedure. You can rename your procedure (and file name) so that it doesn't conflict with PLOTS.

    PRO my_plot
      num=findgen(40)*10
      line=sin(num*!DtoR)
      plot, num, line
    END
    
    IDL> my_plot