pro plotxsinx device, retain=2, decomposed=0 loadct, 39 !p.color=0 !p.background=255 x=(4*!pi) * findgen(1025)/1024 - (2*!pi) ;findgen created an array of 1025 numbers from 0 to 1024 and normalizes the values of those numbers in the array so they go from -2pi to 2pi y=x*sin(x^2) ;create the function plot, x, y, XRANGE=[-2*!pi, 2*!pi], XSTYLE=1,THICK=2, TITLE='Graph of f(x)=x sin(x!E2!N)', $ XTITLE='x', YTITLE='f(x)', Xticklen=1.0, YTicklen=1.0, XGridStyle=1,YGridStyle=1 ;XRANGE gives you the range of x values for the plot, while XSTYLE=1 makes sure we are displaying the exact interval (IDL normally wants to produce even tick marks, so our rance will be larger than what we ask, hence the need for XSTYLE). ;Other commands are as before end