Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.stsci.edu/hst/training/events/IDLTopics/SSD98IDL/IDL_plotting3.html
Дата изменения: Unknown Дата индексирования: Sun Dec 23 19:37:47 2007 Кодировка: Поисковые слова: п п п п п п п п р п р п р п р п р п р п р п р п р п р п р п р п р п п п п п п п п п п п п п п п п п п |
In Line Plots II, we have learned how to specify the type of fonts and the position
of a string placement in the xyouts procedure. The same set of font-manipulation
commands is also applicable to any character strings. You can use the same set of
commands to display different fonts and different positionings in the plot titles.
For example, below we will plot out the spectrum from the previous exercise and format
the units for the x-axis title.
IDL> plot, velocity, smoothed_flux, xrange=[-2000,2000],xstyle=1, $
IDL>yrange=[-5.e-16,10.e-16], $
IDL>ystyle=1, title='GHRS Spectrum, velocity vs smoothed flux', $
IDL>xtitle='Velocity (km s!E-1!N)', ytitle='flux'
IDL has a number of ways to position line plots and other IDL graphical displays
in the display window. The plot position may be set by !P.Position system
variable or by the Position keyword to the Plot command. Here we will only
explore the method to create multiple plots in a single display window or graphic
device.
In IDL, the !P.Multi system variable can be used to create multiple plots
in a display window. !P.Multi is a five element vector defined as follows:
!P.Multi(0) | Contains the number of plots remaining on the page. Start with this as 0 to clear the page. |
!P.Multi(1) | The number of plot columns on the page. |
!P.Multi(2) | The number of plot rows on the page. |
!P.Multi(3) | The number of plots stacked in the Z direction. |
!P.Multi(4) | If 0, plots are displayed from left to right and top to bottom, i.e., the plots are displayed in rows. If 1, plots are displayed from top to bottom and from left to right, (i.e., the plots are displayed in columns). |
IDL> !P.Multi = [0, 2, 2, 0, 1]
Now as you display each of the four plots, each plot fits into a quarter of the display
window:
IDL> plot, num, line, linestyle=0
IDL> plot, num, line, linestyle=1
IDL> plot, num, line, linestyle=2
IDL> plot, num, line, linestyle=3
To reset back to display a single plot on a page, the !P.Multi should be set to 0.
IDL> !P.Multi = 0
Exercise: See if you can plot the original and smoothed spectra side by side.
In IDL, you can use the IEEE standard value NaN (not a number) to denote
bad or defective values in your data sets. The NaN values are stored in
the system variable !Values. To assign the value to a variable:
IDL> badvalue = !Values.F_NAN
Example: Here we will create a dataset with seven random bad values:
IDL> badData = line
IDL> badData(Fix(RandomU(seed, 7)*100)) = !Values.F_NAN
You can plot this bad data by typing:
IDL> plot, badData
When you plot a dataset containing NaN, the bad values are simply dropped
out.
Another way to handle defective data is to screen it out with either the Max_Value
or Min_Value keywords to the Plot command. The keywords do not
perform the screening, and so you will have to do the screening yourself. If you
know the exact value for the bad data, you can select them using the where
function. Below demonstrates how to select all values between -0.15 and 0.15 as bad
values. After the selection process, you could set the values to some value greater
than the real data values and screen them with the Max_Value keyword.
IDL> badData = line
IDL> badValues = where(badData gt -0.15 and badData lt 0.15)
IDL> badData(badValues) = 100.0
IDL> Plot, badData, Max_Value = 1.0