IDL1 - increments of 1. i b=2.0 ;Defines the y-intercept...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
; -- Program for homework #1, problem #1. ; Write an IDL code to plot a line with y-intercept of +2 and slope of -3.5. ; ;Define the plotting environment set_plot,'ps' ;Tell IDL to send the output to a postscript file called device,/bold,/times ;Bold-face, Times font. d !p.font=0 ;Makes fonts compatible with the set device (ps in this case). !p.charsize=2.0 ;Text is a bit bigger than the default, which is 1.0. !p.title='Homework #1' ;Main title for the plot ! !y.thick=3 ;Y-axis line is thicker than the default, which is 1.0. !x.thick=3 ;X-axis line is thicker than the default, which is 1.0. ! !y.title='Y Coordinate' ;Labels for Y and X axes. !x.title='X Coordinate' ! ! ;Y and X axes will have ranges *exactly* as set. ! ! !y.range=[-40,40] ;Y axis goes from -40 to 40 !x.range=[-10,10] ;X axis goes from -10 to 10 ! x=findgen(21)-10 ;define a floating point array that goes from -10 to 10 in
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: increments of 1. i b=2.0 ;Defines the y-intercept m=-3.5 ;Defines the slope m y = m*x + b ;Defines the line -- Y will be an array since X is an array. y plot,x,y,thick=8 ;Plot a thick line p xyouts,0.5,0.70,'This is a line',charsize=2.0,/normal ;prints out the string (This is a line) using large characters and normal coordinates: ; 0.3 is the x position and 0.8 is the y position. With the /normal keyword, this tells ; IDL to locate the string at the point (0.3,0.8) where the corners of the plot are defined ; by [0,0] in the lower left and [1,1] in the upper right. ; device,/close ;closes the ps device -- must do this to see the plot correctly ; or you must exit IDL entirely. set_plot,'win' ;Sets the plotting device back to the screen for a windows machine. ; Different commands are used for other operating systems. end...
View Full Document

This note was uploaded on 01/19/2011 for the course ATOC 5235 taught by Professor Randell during the Fall '10 term at Colorado.

Ask a homework question - tutors are online