You are on page 1of 41

IDL Programming Techniaues

Second Edition

David W;Fanlzing, Ph.D.

Descubriendo las Posibilidades

Visualizar Grficos Simple GraphicalSimples Displays


Resumen del captulo
El pan y la mantequilla del anlisis cientfico es la capacidad de ver los datos como simple trasos de lnea , contorno y superficie. En este captulo, usted aprender lo fcil que es mostrar los datos de esta manera. The bread and butter of scientific analysis is the ability to see your data as simple line Tambin aprender a utilizar las variables de sistema y palabras clave para posicionar y visualizar plots, contour plots and surface plots. In this chapter, you will learn how easy it is to graficos simples en pantallas. display your data this way. You will also learn to use system variables and keywords Especficamente, usted aprender: to position and annotate simple graphical displays. Cmo mostrar los datos como un grfico de lneas con el comando Plot Specifically, you will learn: Cmo mostrar los datos como una superficie con los comandos Surface y Shade_Surface Cmo mostrar los datos como un grfico de contorno con el comando Contour How to display data as a line plot with the Plot command Cmo colocar pantallas grficas simples en la pantalla * How to display data as a surface with the Sulfice and Sl~ade-Su~fcommands Cmo utilizar palabras clave ms comunes para anotar y personalizar sus pantallas grficas
Q

Chapter Overview

command display window Pantallas grficas How simples en IDL to display data as a contour plot with the Corztour graphical displays Una pantalla grfica sencilla en IDL un ejemplo degraphical lo que sedisplays llama un grfico How toes position simple in the raster. Es decir, el uso de un grfico, o contorno, o el comando de superficie genera un algoritmo * How to use common keywords to annotate and customize your que ilumina algunos pxeles en la ventana de visualizacin. Tales grficos de trama no tienen persistencia. En otras palabras, una vez IDL ha mostrado el grfico y alumbrado cierta raster graphic. pxeles que no tiene conocimiento de lo que ha hecho. Esto significa, por ejemplo, que tiene IDL no hay manera de responder a el cambio de tamao de la ventana de visualizacin del usuario. an algorithm A simple graphical display in IDL is an example ofSuch whatraster is called a graphics La pantalla grfica no puede, general, ser a dibujada tales circunstancias sino porgenerates volver a have no That en is to say, using Plot, oren C01~tozll; or Szlgace command the graphic and lighted up certain la emisin de los grficos ordenar vez. pixels in the display window. that lightsotra up certain example, that IDL has Sin embargo, los comandos de grficos de trama son ampliamente utilizados en IDL porque son persistence. In other words, once IDL has displayed graphics display rpidos y fcil de usar. Y, comoit se ver, muchas de of las limitaciones a menudo asociada con pixels has no knowledge what it has done. This means, for re-issuing the graphics comandos grficos de trama se pueden superar siuser se tiene cuidado en la forma de escribir no way to respond to the resizing the display window. The cannot, in general, be redrawn inEste suchcaptulo circumstances by programas en IDL que utilizan comandos grficos raster. es unaexcept introduccin a la command over again. conceptos que se necesita saber para mostrar ventanas grficas IDL o producir salida de because copia they are fast associated with impresa directamente con comandos grficos de trama. Los comandos de grficos en Nevertheless, raster graphics commands are widely used in IDL you write IDL Este captulo se ocupa de lo Systems direct and simple toResearch use. And, llamadas as you will see,graphics. many of the limitations oftenyou to the Un tipo diferente de opcin grfica de nombre object graplzics de Research System fue raster graphic commands can be overcome if you are careful in how IDL graphics windows or produce introducido en IDL 5.0. Comandos de objetos son mucho ms difcil de usar, programs grficos that use raster graphic commands. This chapter introduces The graphics commands in you will need to know wi-ite resizeable pero tambin le dan msconcepts poder y flexibilidad en cmo los to programas grficos IDL graplzics. output directly with rasterde graphic commands. widget de lnea de comandos. Ms hardcopy bien, se incluyen en los programas IDL, especialmente A different of graphics option-named object graplzics by Research Systemsthis chaptertype are concerned with what Research Systems calls direct programas (programas con interfaces grficas de usuario). Comandos grficos de objetos son Object graphics commands are considerably harder to use, 5.0. was introduced in IDL discutido ms adelante en este libro.
Q

Simple Graphical Displays in IDL

but they also give you more power and flexibility in how your IDL graphic programs

Sii~~ple Grnplzical Displays

Creacin de grficos de lnea

are written. Object graphics comnlands are not really meant to be typed at the IDL command line. Rather, they are included in IDL programs, especially widget programs (programs with graphical user interfaces). Object graphics commands are discussed later in this book.

La forma ms sencilla de generar un grfico de lneas es trazar un vector. Usted puede utilizar Line Plots Creating

el comando LoadData para abrir los datos serie deTiempos. El comando LoadData es uno de LoadDatcr The simplest way to generate a line plot is to plot a vector. You can use the los programas de IDL que vienen con este libro. (Ver "IDL programas y archivos de datos utilizados command to open the Tilne Series Data data set. The LoaclDnta command is one of en el libro "en la pgina 4 para obtener ms informacin.) Se utiliza para cargar los conjuntos de datos the IDL programs that came with this book. (See "IDL Programs and Data Files Used utilizados en los ejemplos de programacin de este libro. Para ver los conjuntos de datos a su in the Book" on page 4 for more information.) It is used to load the data sets used in disposicin, elprogramming tipee esto: examples in this book. To see the data sets available to you, type the

this:
IDL> curve = ~ o a d ~ a t a o
Si usted se olvid de incluir los parntesis cuando se ha emitido el mandato LoadData If you forgotes to posible include thetenga parentheses when you issued the LoadData anteriormente, que que volver a compilar el programa LoadDatacommand antes above, you may need to re-compile the LoadData program before de que funcione correctamente. La razn de esto es que IDL ahora piensa it "loaddata" will work properly. The reason for this is that IDL now thinks "loaddata" is a variable and acts es una variable y actua en consecuencia cuando lo ve en una lnea de comandos. accordingly when it sees it in a command line. Re-compiling the function will get the Vuelva a compilar la funcin de Nombre "loaddata" en la lista de los nombres de "loaddata" name on IDL's list of function names where it belongs. Type this: las funciones que le corresponde a IDL. Escriba lo siguiente:

IDL>

. Compile

LoadData

Los Datos en Tilne serie Series de tiempo son el primer datos en la lista LoadData. Haga clic on en l. Los The data set isconjunto the first de data set on the list. Click it. The Data LoadData datos yadata est is cargados en la into variable curve. Otra manera para seleccionar estethis primer conjunto deis to cul-ve. Another way to select first data set now loaded the variable datos escall llamar a LoadData likeas: this: LoadData

IDL> curve = LoadData (1)

To see how variable curve is defined, type Para ver cmo se define la the variable curve, escriba lo siguiente:
IDL> Help, curve

this:

CURVE

FLOAT

= Array [loll

see es that a punto floating point one-dimensional of 101 Usted ve queYou la curva uncuive vectoris de flotante (ovector matriz (or unidimensional) de 101array) elementos. elements. Para trazar el vector, escriba: To plot the vector, type:
IDL> Plot, curve
IDL intentar trazar tantry bien linea como con la menor cantidad de informacin que tiene. IDL will touna plot as nice a sea plotposible as it possibly can with as little information as it has. En este caso, el eje X u horizontal est marcada de 0 a 100, correspondiente a la nmero de elementos In this case, the X or horizontal axis is labeled from 0 to 100, corresponding to the en el vector,number y el eje Y o elements vertical se in etiqueta con los datos (es decir, este es el eje de datos of the vector, and thecoordenadas Y or vertical axis is labeled with data dependiente). coordinates (i.e., this is the dependent data axis). Pero la mayora de las veces un grfico de lneas muestra un conjunto de datos (los datos independientes) But most of the time a line plot displays one data set (the independent data) plotted representados en contra de un segundo conjunto de datos (los datos dependientes). Por ejemplo, la curva against a second data set (the dependent data). For example, the curve above may anterior puede representa una seal que se recogi sobre un cierto perodo de tiempo. Es posible que represent a signal that was collected over some period of time. You might want to plot desee trazar el valor de la seal en algn momento de tiempo. En ese caso, se necesita un vector de la the value of the signal at some moment of time. In that case, you need a vector the misma longitud que el vector curve (por lo que puede tener uno-a-uno) y una escala en las unidades same length as the curve vector (so you can have a one-to-one correspondence) and de tiempo para el experimento. Por ejemplo, puede crear un vector tiempo y plotearlo contra el vector scaled into the units of time for the experiment. For example, you can create a time curve, as:

vector and plot it against the curve vector, like this:


IDL> time = FIndGen(lO1)* (6.0/100) IDL> Plot, time, curve

FIlzdGerz command a vector of van 101 elements from to 100. El comandoThe FIndGen crea un vector de creates 101 elementos que de 0 a 100. going La escala del0 factor de The multiplication factorde scales each element so that the result a vector of 101 multiplicacin para cada elemento manera que el resultado final es final un vector deis 101 elementos 0 to 6. Your graphical output elements going fromdebe que van de 0 a 6. Su salida grfica ser similar a la de Figura 1. should look similar to that in Figure 1.

Creating Line Plots

Figura I: una de of losthe datos independientes (tiempo) los datos de dependiente (curve). I: grafica Figure independent data (time)versus versus the dependent data (curve). A plot Tenga en cuenta que no hay ttulos en los ejes asociados con esta trama. La colocacin de ttulos en Notice that there are no titles on the axes las associated this plot. titles on ventana de grficos es fcil. Slo tiene que utilizar palabras with claves XTitle e Placing YTitle. Por ejemplo, and keywords. For example, to label XTitle YTitle graphics plots is easy. Just use the para etiquetar la trama curve, puede escribir lo siguiente:

the curve plot, you can type this:

IDL> Plot, time, curve, XTitle=ITime Axis1, $

YTitle=ISignal Strength1

You can even put a title on the entire by con using the Title keyword, like this: Usted puede incluso poner un ttulo en toda la plot parcela la palabra clave Title, as:
JDL> Plot, time, curve, XTitle='Time Axis1, $

YTitle=lSignal Strength1, Title=lExperiment 35M1


Su salida ser similar a la ilustracin en la Figura 2. Tenga en cuenta que la pantalla muestra lneas Your output will look similar to the illustration in Figure 2. Note that the display blancas sobre un fondo negro, mientras que la ilustracin muestra las lneas negras sobre un shows white lines on a black background, while the illustration shows black lines on a el fondo blanco. Estas ilustraciones se encapsulan archivos PostScript producidos por IDL. white background. These illustrations are encapsulated Postscript files produced by Es comn que el dibujo y los colores de fondo se invierta en el archivos PostScript. (Consulte la IDL. It is common for the drawing and background colors to be reversed in PostScript seccin "Problema: Los dispositivos PostScript uso de fondo y el trazado Colores Diferente "en la files. (See "Problem: PostScript Devices Use Background and Plotting Colors pgina 189 para obtener ms informacin.)

Differently" on page 189 for more information.)

Experiment 35M
30

5 m

G g m
iTj

20
10

0 0

4 Time Axis

Figura 2: una simple lnea ploteada con ejes etiquetados y un ttulo

Figure 2: A simple line plot with axes labels and a plot title.

Si~nple Graphical Displays


Tenga en cuenta que el ttulo de la trama es un poco mayor que las etiquetas de los ejes. De hecho, 1.25 times that the plot title is slightly larger than de the axeslas labels. In fact,de it is es 1,25 Notice veces tan grande. Usted puede cambiar el tamao todas anotaciones la trama con Charsize as large. You can change the size of all the plot annotations with the la palabra clave CharSize. Por ejemplo, si tus ojos son como el mo, es posible que desee que el eje keyword. For example, if your eyesgrandes, are likecomo mine, you might want to make the axis de caracteres sea aproximadamente 50% ms este:

characters about 50% larger, like this:

IDL> Plot, time, curve, XTitle=ITime Axis', $

YTitle='Signal Strength1, Title=l~xperiment3 5 M 1 , $ CharSize=1.5


Si desea tamao la fuente size de todas las pantallas grficas sea ms grande de lo normal, If que youel want thede character on all your graphic displays to be larger than normal, se puede establecer el campo CharSize lathe variable de sistema as: ChnrSize fielden on plotting systemtrazado, variable, like this: you can set the

IDL> ! P.CharSize = 1.5

Nowlas subsequent graphics plotstendrn will have larger characters, unless specifically all Ahora todas parcelas grficos posteriores caracteres ms grandes, a menos que overruled by the ChnrSize keyword on a graphics output command. sea especficamente revocada con la palabra clave CharSize en un comando de salida de grficos. Usted puede incluso cambiar el the tamao de los caracteres de individual cada eje individual el You can even change character size of each axis bymediante using the Palabra[XYZIChnrSize clave [XYZ]CharSize. Por ejemplo, si desea que el eje anotacin Y para ser dos veces keyword. For example, if you want the Y axis annotation to be twice el tamao del ejeof X the de anotacin, puede escribir siguiente: the size X axis annotation, youlo can type this:
IDL> Plot, time, curve, XTitle='Time Axis', XCharSize=l.O, $

YTitle=lSignal Strength', YCharSize=2.0


Tenga cuenta que las [palabras clave [XYZ]charSize utilizancharacter el tamaosize de la fuente actual Note en that the [XYZIChnrSize keywords use the current as the base from como el punto de partida que calculan sus propios tamaos. El tamao de la fuente de corriente which they calculate their own sizes. The current character size is always stored in the siempre almacena en la variable del sistema ! P.CharSize. Esto que keyword si se establece CharSize. This means that thesignifica XCharSize to 2 ! l ? if you set systemse variable lawhen palabra clave XCharSize a 2 cuando la variable del sistema !P.CharSize tambinwill se establece the !RCharSize system variable is also set to 2, then the characters be four times their normal size. en 2, a continuacin, las fuentes sern cuatro veces su tamao normal.

Personalizando los trazos de la grfica Customizing Graphics Plots


Este es un simple grfico de lneas, sin mucha informacin asociada con l, adems de los datos en s. Pero muchas maneras de personalizar y anotar trazos de lnea. El comando plot se puede This ishay a simple line plot, without much information associated with it, aside from the modificar con ms de 50 palabras claves diferentes. stos son algunos de las cosas que usted puede data itself. But there are many ways to customize and annotate line plots. The Plot hacer:

commandthings can you might want


modificar los estilos de lnea with y grosores be modified over 50 different keywords. Here are a few

of the

to lneas do: entre ellos utilizar smbolos con o sin


crear sus propios smbolos trazado modify line styles or thicknesses

use color symbols with or without linescaractersticas between them aadir en su parcela para resaltar importantes
cambiar layour longitud de las marcas o el nmero de intervalos create own plotting symbols

add la color in logartmica your plot to important utilizar escala enhighlight los ejes de la trama features
cambiar el rango de datos para trazar slo el subconjunto de los datos que usted est interesado eliminar los ejes o de otra manera cambiar el estilo de la trama

change the length of tick marks or the number of tick intervals Modificacin de estilos de lnea y grosores Modifying Line Styles use logarithmic scaling on the plot axes
Supongamos, por ejemplo, que you quera trazar to sus datos condata diferentes estilos de line lnea. Para una Suppose, for example, wanted plot your with different styles. For a

this: linemucho with aestilo longlnea dash line style, you intentar can try lo lnea con de trazos, puede siguiente: eliminate axes or otherwise change the style of the plot

change the data range to plot just the subset of the data you are interested in

and Thicknesses

IDL> Plot, time, curve, LineStyle=5 Diferentes estilos de lnea son seleccionados por trazos de lnea mediante el uso de la palabra Different line styles are selected for line plots by using the LirzeStyle keyword with clave LineStyle uno de los nmeros ndices se muestran en la Tabla 3. Por ejemplo, si usted one of the index numbers shown in Table 3. For example, if you wished to plot the desea trazar la curva con lnea discontinua, se encuentra la palabra clave lineStyle a un valor curve with dashed line, you set the Linestyle keyword to a value of 2, like this: de 2, as: IDL> Plot, time, curve, LineStyle=2

Cztstontiziirg Grcrplzics Plots

nmero ndice

estilo de lnea slido puntadas guiones punto y guiones guion punto punto guiones largos

Tabla 3: 3: El estilo de line lnea se puede cambiar asignando estos nmeros de ndice The style carz be clta~zged by assignirzg these index nz~~nbers to the Table para la palabra clave LineStyle. Linestyle keyword. El grosor de las lneas utilizadas parcelas deplots lnea can tambin cambiar. ejemplo, si usted The thickness of lines en used on line alsose bepuede changed. For Por example, if you quera que la trama se muestra con lneas discontinuas que eran tres veces ms gruesa de lo normal wanted the plot displayed with dashed lines that were three times thicker than normal puede escribir lo siguiente: you can type this:

IDL> Plot, time, curve, LineStyle=2, Thick=3

Mostrar datos con smbolos lugar las lneas Displaying Data with Symbolsen Instead ofde Lines
Supon que quieres delinear tus datos con smbolos en lugar de las lneas. Con la palabra Linestyle Suppose you wanted to de plot your data symbols instead of lines. Like the (estilo de lneas), similar al ndice nmeros que with existe nos permitirle escoger los smbolos Linestyle keyword, similar index numbers exist to allow you to choose different diferentes para tu lnea de trazo. La tabla 4 le muestra los nmeros posibles de ndice que usted puede symbols for your line plots. Table shows you the possible index numbers you can 4 usar con la palabra PSym ( Plotting Symbol ) . Por ejemplo, puede dibujar una lnea de asteriscos use with the PSyni (Plotting Syr?ibol) keyword. For example, you can draw the plot poniendo la palabra PSym igual a 2, as:

with asterisks by setting the PSyr?z keyword to 2, like this:


IDL> Plot, time, curve, PSym=2
su salida debe ser similar a lalook salida en la figura 3.output Your output should similar to the

in Figure 3.

Figura 3: Un de lnea los datos delineados como smbolos en lugar dea como A line Figure 3: trazo plot con with the data plotted as symbols instead of as line.una lnea.

Mostrando datos con lneas y smbolos


Puede unir sus smbolos con lneas usando un valor negativo para la palabra PSym. You can plot con symbols withunidos lines by using a negative value for the PSym Por ejemplo, paraconnect delinear your sus datos tringulos por una lnea llena, teclee
D L > Plot, time, curve, P S p = - 5

Displaying Data with Lines and Symbols

keyword. For example, to plot your data with triangles connected by a solid line, type

Siirtple Graphical Displays


Para crear los smbolos ms grandes, aada la palabra SymSize . Aqu el smbolo es dos veces To create larger symbols, add the SyrlzSize keyword like this. Here the symbol is twice el "tamao normal". Un valor de 4 haran el smbolo cuatro veces su tamao normal, y the "normal" size. A value of 4 would make the symbol four times its normal size, and as susesivamente. SO on.
IDL> Plot, time, curve, PSym=-5, ~ y m ~ i z e = 2 . 0

ndice de Nmero

el uso de smbolos de dibujos Ningn smbolo es usado y los puntos se unen por lneas. Signo ms Asterisco Perodo

4
5

Diamond Diamante Tringulo Tiiangle Cuadrado Square X

6
7
8

Definido por eldefined usuario (con el UserSyn? procedimiento de UserSym). User (with the procedure). este ndice nonot seused usa for para algo ! index is anything! This Los datos Data se dibujan en in el histogram modo de mode. histograma. is plotted Los valores negativos de PSym une smbolos conlines. las lneas. Negative values of connect symbols with PSYIII

9 10

-PSyn?

Table Tlzese are the izuntbers you usar cancon ztse tlze PSym keyword to 4: son TABLA 4:stos los nmeros deindex ndice que usted puede la witlt palabra clave de PSym para producir produce different plotting symbols on para your plots. Note using diferentes smbolos. Nota usando un nmero negativo PSym, unir los that smbolos cona las lneas.

Creando

negative number for the plotting symbol will coizrtect the symbols with sulines. propio dibujo smbolico

Si se siente creativo, puede an crear sus propios dibujos smbolicos. El comando UserSym If you feeleste creative, you can even create your own su plotting symbols. The Usedyn? es usada para propsito. Despus que ha creado smbolo especial, usted lo escoge command is used for this purpose. After you created symbol, you un poniendo la palabra PSym igual a 8. Aqu est unhave ejemplo queyour crea special una estrella como P S y m 8. keyword equal to Here is an example that creates an select it by setting the smbolo. El vector (x, y) define los vertices de la estrella como compensaciones del origen y and define the vertices of the star as offsets from x star as a symbol. The vectors a (0,0). Nosotros podemos crear un smbolo lleno poniendo la palabra Fill en la orden the You can create a filled symbol by setting the F i l l keyword on the origin at (0,O). de UserSyrn.

UserSyrn command.
IDL> IDL> IDL> IDL> IDL> IDL>
X

[O.O, 0.5, -0.8, 0.8, -0.5, 0.01 [1.0, -0.8, 0.3, 0.3, -0.8, 1.01 TvLCT, 255, 255, 0, 150 UserSym, X, y , Color=150, /Fill Device, Decomposed=O Plot, time, curve, PSym=-8, SymSize=2.0
=

y =

Your output should look similar to theen output in Figure 4. Su salida deba parecer similar a la salida la figura 4.

Hacer las lnea de Drawing Line indibujo Color en color Plots


You can draw youren line plots diferentes. in different( colors. (Colors are discussed in detail in Puede dibujar sus lnea colores los colores se discuten en detalle IDL" page 81. For now, justslo typerepresente the TvLCT "Working with Colors " trabajando con colores en in IDL " enon la pgina 81. Por ahora, lacommand ordenTvLCT below. You exactamente will learn exactly what the command means Basically, you are abajo. Estudiar lo que el comando significa mslater. tarde. Bsicamente, est color vectors that describe the red, green, and blue components of the loading three cargando 3 vectores de colores que describen los componentes rojos, verdes, y azules de el

Cztsto~?zizi~zg Gr~apltics Plots

Figura 4:4: Un smbolo de dibujo creado por UserSym A plot with syntbols created by the producir. UsesSynt procedzcre. Figzcre

triple color que describen los colores carbn,amarillos y verdes.) Por ejemplo, cargue los colores triples that describe the and green colors.) For example, load a carbn, color amarillo y verde en ndices decharcoal, color 1,2yellow, , y 3 as: charcoal, yellow and green color into color indices 1,2, and 3 like this:
IDL> TVLCT, [70, 255, 01, [70, 255, 2551
I

[70, 0, 0 1

Para dibujar el simbolo de en a una base de carbn, teclee: To draw the plot inamarillo yellow on charcoal background, type:
IDL> Plot, time, curve, Color=2, Background=l

Si nada aparece en su ventana cuando teclea la orden arriba, es probable porque est corriendo If nothing appears in your display window when you type the command above, it is IDL en muestras de colores de running 24-bit y tiene descomposicin color . Se estudiar ms sobre likely because you are IDL la on a 24-bit color de display and you have color colorear la descomposicin ms tarde, pero para ahora, estando seguro de la descomposicin decomposition turned on. You will learn more about color decomposition later, but for de color se be va ha usar. Representamos el tipo color apropiado: now, sure color decomposition is de off. Type this to produce the proper colors:

Si usted quiere la lnea que sea un color diferente, debe delinear primero los datos con el IDL> slo Device, Decomposed=O NoDntn keyword turned on, then overplot line with the (OPlot command la palabra NoData, entonces redibuja la lnea con lathe orden de OPlot discuta debajo de ). IDL> Plot, time, curve, Color=2, Background=l (discussed below). For amarillo example, touna have a yellow plot on a charcoal with Por ejemplo, para tener un lote en base de carbn, con los datos background, en verde, teclee: If you just the line to be a different color, you must first plot the data with the the want data in green, type:
IDL> Plot, time, curve, Color=2, Background=l , / ~ o ~ a t a IDL> OPlot , time, curve, Color=3

Limitando el rango de trazos de lnea


Limiting the Range of Line Plots
on the X axis, type:
IDL> Plot, time, curve, XRange= [2,4]
O, para trazar slo la just parte deportion los datos que valores de Y entre 10 y 20 y X and 20 10 Or, to plot the of thetiene datalos that has Y values between valores comprendidos entre 2 y 4, escriba: values that fall between 2 and 4, type: No todos los datos deben ser trazados en un grfico de lneas. Usted puede limitar la cantidad de datos a line of your data must be plotted onpara plot. You can limit the of data que tramaNot con all palabras clave XRange. Por ejemplo, trazar slo los datos que se amount encuentran entre 2 y 4 you plot with keywords. For example, to plot just the data that falls between 2 and 4 en el eje X, tipear esto:

and X

, XRange= [2,41 IDL> Plot, time, curve, ~ ~ a n g [10,20] e=


Usted puede invertir la direccin de los datos, especificando el rango de datos con palabras YRange. You can reverse the direction of the data by specifying the data range withclave keywords. Por ejemplo, dibujarto la draw grfica con el eje de the Y invertida, lo siguiente: Forpara example, the plot with Y axis escriba reversed, type this:

1 IDL> plot, time, curve, YRange= [30 0


El resultado debe ser similar a la ilustracin de lathe figura 5, a continuacin. Your output should look similar to illustration in Figure 5, below.

Siitzple Graphical Displays

Figura 5:5: una A trama el punto cero del eje localizado en la parte Figure plotcon with the zero poirzt ofY the ortsuperior the topdel the plot. of trama. Y axis located Si rango de eje elegido no est comprendida en IDL's el sentido de iDL que en el rango del Iftu your chosen axis range doesn't fall within sense of what anestetica aesthetically eje debe ser agradable, IDL puede ignorar el pedido-para el rango. Por ejemplo, trate con t ~ y pleasing axis range should be, IDL may ignore the asked-for range. For example, este comando: this command:

IDL> Plot, time, curve, XRange=[2.45, 5.641


El rango del eje X va de 2 a 6, lo cual no es exactamente lo que usted pidi hacerIDL en IDL. The X axis range goes from 2 to 6, which is not exactly what you askedto do. To asegurarse de que siempre obtendr el rango del eje que pides, establece la palabra clave keyword to 1, like XStyle a 1, al igual que esto:

make sure you always get the axis range you ask for, set the XStyle this:

IDL> Plot, time, curve, XRange=[2.45, 5.641, XStyle=l


Usted sobre la palabras clave [XYZ]Style en lathe siguiente seccin. You aprender will learnms more about the [XYZIStyle keywords in next section.

Cambiando elStyle estilo de lneas Changing the of Line Plots grficas


Es cambiar muchasmany caracteristicas de sus lneas grficas, la forma que lo It posible is possible to change chasacteristics of your plots, incluyendo including the wayen they look. For example, you not caseel for the box style de of los thetrazos line plots. If not, you can mira. Por ejemplo, usted no may puede cargar cuadro de estilo de lnea. Si no, usted keywords. TheStyle. values you can que use change the plot characteristics with the [XYZIStyle puede cambiar las caractersticas de la trama con la palabras clave [XYZ] Los valores For example, to en 5. with utilizar these keywords to change line plot styles is shown in Table puede con estas palabras clave para cambiar estilos de trazado de lneas se muestran X axis and one Y axis, type: eliminate box axes and have just one la Tabla 5. Por ejemplo, para eliminar los ejes de la caja y tener un solo eje X y un eje Y, escriba:

IDL> Plot, time, curve, XStyle=8, YStyle=8

valor

descripcin de las propiedades del eje afectado


forzar exactamente el rango del eje expandir el rango del eje suprimir el eje entero suprimir el estilo de caja del eje (dibibuja solo un eje) inibe la posicin de salida del eje Y con valor a 0. (solo el eje Y)

the key~vord values the [XYZIStyle keywords that set Table Tabla 5: Una5: table A de table valoreof de palabras claves parafor la palabra clave [XYZ]Style que ponen properties for los thevalores axis. Note that values cart be added to specih propiedades para el eje. Note que pueden ser aadidos para especificar ms de more than one axis property. una propiedad del eje.

Czrstoinizing Graphics Plots


Puede activar un an ejeaxis completamente. Por ejemplo, para mostrar la trama conwith un solo eje Y,Y You can turn off completely. For example, to show the plot a single seaxis, puede escribir: you can type:

IDL> Plot, time, curve, XStyle=4, YStyle=8


ElYour resultado debe ser similar la ilustracin la Figura 6. output should look a similar to the en illustration in Figure 6.

Figura 6:6: UnaA grafca con el ejeX de X suprimid y la caja eje Y apagada Y box Figlcre plot with the axis srcppressed aitd del axes turned off. Se podra mostrar la misma grafica con el eje Y y lneas de cuadrcula:

You could show the same plot with Y

and Y grid lines: axes

La palabra clave [XYZ]Style se puede utilizar para establecer ms de una propiedad de eje a la vez. Plot, time, curve, YTickLen=l, YGridStyle=l IDL> Este se realiza mediante la adicin de los valores XStyle=4, adecuados en conjunto. Por ejemplo, se ve en la Tabla 5 elThe valor para forzar el rango exacto del eje es 1, y el valor para suprimir el dibujo dea los ejesThis [XYZIStyle keyword can be used to set more than one axis property at time. de la cajais es de 8. Para ambos hacen un rango exacto de eje X y para suprimir los ejes de la caja, done by adding the appropriate values together. For example, you see from Table 5 estos valores suman, manera: that se the value de to esta force the exact axis range is 1, and the value to suppress the drawing

Para crear un grillado completo en un diagrama values are added together, like this:de puntos se realiza (extraamente) con la palabra clave TickLen, por ejemplo: IDL> Plot, time, curve, XStyle=8+1, XRange= [ 2 , 5 ]

of box axes is 8. To both make an exact X axis range and to suppress box axes, these

externamente las marcas se crean con un valor negativo con la palabras clave [XYZ] TickLen. To create a full grid on a line plot is accomplished (strangely) with the TickLerz Por ejemplo, para crear todas las marcas exteriores, escriba:

keyword, like this:

Para crear externamente las marcas decurve, los ejes individuales, utilice la palabras clave [XYZ] TickLen. time, TickLen=l IDL> Plot, Por ejemplo, para tener externamente las marcas slo del eje X, escriba:

Outward facing tick marks are created with a negative value to the [XYZlTickLe~z

keywords. For example, tode create all de outward facing marks, Tambin puede seleccionar el nmero marcas mayor y menor tick grado de un type: eje con las palabras keywords. For example, facing just type: clave [XYZ]Tick y [XYZ]Minor. Por ejemplo, para crear trama con slo de axis, graduacin IDL> Plot, time, curve, T i c la k~ en=0. 0 3 dos intervalos principal, cada uno con 10 marcas de graduacin secundarias, en el eje X, escriba: major and minor curve, XTickLen=0.03 IDL> Plot, have outward tick marks the X To create outwardtime, facingto tick marks on individual axes, useon the [XYZITickLerz

[XYZITicks and [XYZIMinor keywords. tothe create the plot with only two You can also select the number ofminor For tick marks on an axis with the major tick intervals, each with tick example marks, on X axis, type: 10 IDL> Plot, time, curve, XTicks=2, XMinor=lO, XStyle=l

Sintple Graplzicnl Displays

Trazando mltiples conjuntos datos en lneas grficas Plotting Multiple Data Sets on Line de Plots
Usted no est limitado a un solo conjunto de datos en un grfico de lneas. IDL le permite dibujar You are not restricted to just a single data set on a line plot. IDL allows you to plot as muchos conjuntos deyou datos que quepa en el set mismo conjunto de ejes. El comando is Oplot utiliza many data sets as like on the same of axes. The command usedse for OPlot para propsito. Escriba los siguientes comandos. Suoutput salida ser a lathe ilustracin thiseste purpose. Type the following commands. Your will similar look like illustration en Figura7. 7. inla Figure

IDL> Plot, curve IDL> OPlot, curve/2.0, LineStyle=l IDL> OPlot , curve/5.0, LineStyle=2

Figura 7: Un ilimitado de conjuntos datos secan puede elthe mismo grafico de lnea. 7:nmero Figure An unlimited number ofde data sets bemostrar plotteden on same line plot.

Figura 8: un deplot lneawith con dos Y. El segundo eje se sita una posicin conveniente Figure A line twoejes Y axes. The second isen positioned with the Axis 8:grafca axis con el comando Axis. Est seguro deto salvar los datos usando la palabra clave Save. command. Be sure save the data scaling with the Save keyword. El comando inicial Plot establece la escala de datos (en el ! X.S y ! Y.S Escalado parmetros) para The initial Plot command establishes the data scaling (in the !X.S and ! X S scaling todas las tramas subsiguientes. En otros palabras, se trata de los valores en el sistema de Variable parameters) for all the subsequent plots. In other words, it is the values in the !X.S and ! X.S y ! Y.S que dice IDL cmo sacar un punto en el espacio de datos y colquelo para mostrar en !Y;S system variable that tells IDL how to take a point in data space and place it on the el display espacio in dedevice coordenadas del dispositivo. Asegrese de initial que la parcela inicial rangos de ejes coordinate space. Make sure the plot has axis tenga ranges sufficient suficientes para abarcar todas las parcelas posteriores o se recortarn los datos. Utilice las palabras to encompass all subsequent plots, or the data will be clipped. Use the XRnrzge and claves XRange y YRange enfirst el primer Plot crear una serie de datos suficientemente keywords in the command topara create a data range large enough. To Plot comando YRarzge grande. Para distinguir los diferentes conjuntos de datos, puede de lnea, distinguish different data sets, you can use different line utilizar styles,diferentes differentestilos colors, differdiferentes colores, diferentes smbolos , etc

Creatirtg Sztrface Plots

of the same El comando Oplot acepta muchas de las mismas palabras clave que el Comando Plotkeywords acepta.
2551, [O, 0, 01, 1

the

IDL> OPlot, curve/2.0, Color=2 IDL> OPlot , curve/5.0, Color=3

Plotting Data ongrfica Multiple Axes Representacin de datos sobre varios ejes
A veces, usted desea tener dos o ms conjuntos de datos en la misma lnea argumental, pero desea the data sets to use different Y axes. It is easy to establish as many axes as you need que los conjuntos de datos a utilizar esten en diferentes ejes Y. Es fcil establecer tantos ejes como with the Axis command. The key to using the Axis command is to use the Save sea necesario con el comando Axis. La clave para usar el comando Axis es utilizar la palabra clave keyword to save the proper plot scaling parameters (i.e., those stored in the !X.S and Save para salvar los parmetros adecuados de escala (es decir, los que estn almacenados en la !Y;S system variables) for subsequent plotting calls. Variables del sistema ! X.S y ! Y.S ) para las subsiguientes llamadas de trazado . Por ejemplo, he aqu una de las parcelas se dibuja y el comando Axis juntoalong con lawith palabra For example, here one plot is drawn and the Axis command theclave Savesave se utilizakeyword para establecer un segundo eje Y. La curva en el comando Oplot se utilizar los factores de is used to establish a second Y axis. The curve in the OPlot command will escala guardados por el comando de eje para determinar su colocacin en la parcela. use the scaling factors saved by the Axis command to determine its placement on the Los comandos apropiados son los siguientes: plot. The proper commands are these:

Sometimes you wish to have two or more data sets on the same line plot, but you want

Creating Surface Plots Cualquier conjunto de datos en dos dimensiones se puede mostrar como una superficie (con
eliminacin automtica de lineasdata ocultas) IDL un simple En primerhiddenlugar, Any two-dimensional set en can be con displayed as comando a surfaceSurface. (with automatic debe abrir un archivo de datos. Utilice el comando LoadData para abrir la el conjunto de datos de file. line removal) in IDL with a single Surface command. First, you must open a data elevacin, as: Use the LoadData command to open the Elevation Data data set, like this:

Creacin de grficos de superficie


IDL> peak = LoadData (2)

IDL> Plot, curve, YStyle=8, YTitle= 'Solid Line' , $ Position = [0.15, 0.15, 0.85, 0.951 IDL> Axis, YAxis=l, YRange= [O,2001 , /save, $ YTitle='Dashed Line' IDL> OPlot , curve*5, LineStyle=2 La palabra clave Position se utiliza la primera parcela lathe pgina. Para saber more ms The Positiorl keyword is para usedcolocar to position the first ploten on page. To learn sobre laabout palabra clave Posicin , vea "La Salida grfica de la ventana de visualizacin" en la the Positioi~ keyword, see "Positioning Graphic Output in the Display Window" pgina 44. salida a la ilustracin dethe la Figura 8. on Su page 44. ser Yoursimilar output will look like illustration in Figure 8.

Se puede ver que se trata de una matriz de punto flotante de 41-por-41 mediante el comando Help, as:

You can see that this is a 41-by-41 floating point array by typing the Help command, like this:
IDL> Help, peak

This data can viewed a superficie surface with single Estos datos pueden ser be vistos comoas una con a un nico command: comando:
IDL> Surface, peak, CharSize=l.5

Your output should similarde tola the illustration El resultado debe ser similar a look la ilustracin Figura 9.

in Figure 9.

Notice Sutj4aceSurface command is given just acomo single as an argument Tenga en cuentathat que if si the el comando da una sola matriz unarray argumento, esta matrizit plots the array as a function of the number of elements (41 in the and directions, X Y es una funcin del nmero de elementos de la matriz (en este caso 41 en las direcciones X e Y). in this case) in the array. (You para used the CltarSize keyword to increase the se character size so (Usaste la palabra clave CharSize aumentar el tamao de la fuente para que puede ver esto command accepts many you can see this easily.) But, as you did before with the Plot command, you can ent plot symbols, etc.especificar The OPlot fcilmente.) Pero, como lo hizo antes con el comando Plot, puede los valores de los ejes specify values for the X and Y axes that may have some physical meaning for you. For Plot command X e Y, que pueden tener algn significado fsico para usted. accepts. Por ejemplo, los valores X e Y pueden example, may be longitude and latitud latitude coordinates. Here we X and Y values ser coordenadas dethe longitud y latitud. Aqu hacemos un vector que se extiende de 24 a 48 255, 01, [O, 255, IDL> TvLCT,de[255, make a latitude vector that extends from 24 to 48 degrees of latitude and a longitude grados de latitud y una longitud este vector to que se extiende desde -122 hasta -72 grados de longitud: Plot, longitude: curve, / ~ o ~ a t a IDL> -72 degrees vector that extends from -122 of IDL> OPlot, curve, Color=l IDL> lat = FIndGen(41) * (24.0/40) + 24 IDL> lon = FindGen(41) * (50.0/40) - 122

Sinzple Graphical Displays

Figura 9:9: Una A grfica de superficie basica de elevacion de datos. basic surface plot of elevatiolz data. Figure

IDL> Surface, peak, lon, lat, XTitle='Longitudel, $ YTitle='Latitudel, ZTitle='Elevationl, Charsize=1.5


Su salida serwill similar a la ilustracin de la figura Your output look like the illustration in 10. Figure

10.

Figura 10:10: UnaA grfica de superficie los valores values significativos asociados con ejes. Figure surface plot withcon meatzirtgful associated with its sus axes. Los parmetros Lon y Lat en el comando anterior se imcrementaron montonamente y The parameters Ion and lat in the command above are monotonically increasing and regularmente. Describiendo los lugares que se conectan las lneas de la cuadrcula de regular. They describe the locations that connect the surface grid lines. But the grid superficie. Pero la cuadrcula no tiene que ser regular. Considere lo que sucede si usted does not have to be regular. Consider what happens if you make the longitudinal data hace los datos longitudinales sean puntos espaciados irregularmente. Por ejemplo, puede points irregularly spaced. For example, you can simulate randomly spaced simular espaciados al azar con puntos longitudinales escribiendo esto:

longitudinal points by typing this:


IDL> IDL> IDL> IDL>

seed = -lL newlon = RandomU(seed, 41) * 41 newlon = newlon[Sort (newlon)] * (24./40) + 24 Surface, peak, newlon, lat, ~ T i t l e = ' L o n g i t u d e ~ $ , YTitle='Latitudel, ~ ~ i t l e = ~ E l e v a t i o Charsize=1.5 n~,

Tu veras, ahora que los valores longitudinales X no espaciados regularmente. Aunque puede look like the data is being re-sampled, itestn is not. You are simply drawing the surface parece que los datos estn siendo re-muestreados, no lo es. Simplemente ests dibujando la superficie lneas de la cuadrcula en las ubicaciones especificadas por puntos de datos de longitud y latitud.

You see now that the longitudinal X values are not regularly spaced. Although it may

Cztstorniziitg Sztrface Plots

grid lines at the locations specified by the longitude and latitude data points. Your Su salida debera similar la ilustracin dein la Figure figura 11. output should beser similar toathe illustration ll.

11: alz Figzcre The same surface plot, bzrt with spaced X vector. Figura 11: El mismo grafico de superficie, pero con unirregularly vector X irregularmente espaciado.

Personalizando los graficos de Superficie Customizing Surface Plots Hay ms de 70 diferentes palabras clave que pueden modificar la apariencia de un grfico de
superficie. de estas palabras clave ha aprendido para el comando Plot. plot. 0 different There De arehecho, over 7muchas keywords that can se modify the appearance of a surface Por In ejemplo, se vio of en these el cdigo anterior you que already el mismolearned ttulo palabras utilizarse para fact, many keywords for theclave Plotpuede command. For anotar los ejes.you Ntese, embargo, que cuando se agrega la palabra clavecan Title al ttulo example, sawsin in the code above that the same title keywords be used este to gira annotate de manera que siempre est however, en el plano XZ when del grfico superficie. Por ejemplo, the axes. Notice, that you de add thatescriba the title is a Title keyword lo siguiente: rotated so that it is always in the XZ plane of the surface plot. For example, type this:

e~, IDL> Surface, peak, lon, lat, ~ ~ i t l e = ~ L o n g i t u d$ ~ que ~it l e = ~ L aSi ti tude Title='Mt. ', Elbertl, Esto no siempre es lo quieremos. deseamos que el ttulo del grafico esteCharsize=1.5 en un plano paralelo a la This pantalla, tendr que dibujar la superficie con el comando Surface, y el ttulo con el comando is not always what you want. If you want the plot title to be in a plane parallel to XYOutS. (Hay informacin detallada sobre el comando XYOutS en la pgina 51) Por ejemplo, the display, you will have to draw the surface with the Surfnce command, and thecomo title esto.: with the XYOutS command. (There is detailed information on the XYOutS command peak, lon, lat, X~itle='Longitude',$ IDL> on page 5 1Surface, like this: .) For example, YTitle='Latitude', Charsize=1.5
IDL> XYOutS, 0.5, 0.90, /Normal, Size=2.0, Align=0.5, $ 'Mt. Elbertl

Rotando la grafica de Superficie Rotating Surface Plots


Es posible que desee rotar un grfico de superficie un ngulo para verlo. Un grfico de superficie You may want to rotate thela angle at which view a surface surface plot can puede girarse alrededor del eje X con palabra claveyou Ax y alrededor del plot. eje Z A con la palabra be rotated about the X axis with the Ax keyword and about the Z axis with the Az clave Az. Las rotaciones se expresan en grados hacia la izquierda cuando se mira desde keyword. Rotations are expressed in degrees counterclockwise as you look from los valores positivos sobre el el origen. Las palabras claves Az keywords y Ax por defecto positive values oneje thehacia axis towards the origin. The Az and h default a to30 30 grados si se omiten. Por ejemplo, para hacer girar la superficie alrededor del eje Z por 60 degrees if they are omitted. For example, to rotate the surface about the Z axis by 6 0 grados y sobre el eje X de 35 grados, escriba: degrees and about the X axis by 35 degrees, type:
IDL>

Surf ace, peak, lon, lat, Az=60, Ax=35, Charsize=l.5

El resultadoYour debeoutput ser similar a la ilustracin la figura in 12. should look like the de illustration Figure 12. Aunque los comandos de superficie grfica directos siguen siendo tiles en IDL, muchos Although graphics surface commands are still in IDL, programadores estn direct encontrando que las superficies representan al objeto enmany clases theuseful object graphics class library programmers are finding that surfaces rendered with de bibliotecas grficas.

Siittple Graplzical Displays

Figura 12: LasSurface graficassplots superficiales pueden rotar con las palabras claves Ax y Az. Figure can bese rotated with tlze arzd 12: Ax Az key~vords. son mucho ms tiles para ellos, especialmente cuando se desean rotaciones de superficie. En parte esto seare debe a grficos superficie rotadas directamente tienen una limitacin artificial Partly que much morede useful to them, especially whenque surface rotations are desired. requiere el eje Z a estar apuntando en una direccin vertical en la ventana de visualizacin. Tales this is because direct graphics surface rotations have an artificial limitation that salidasrequires no limitacin superficies de objetos Para ver cules algunas de las ventajas, Z axis to be pointing ingrficos. a vertical direction in son the display window. No the de ejecutesuch el programa de FSC_Surface, que esta entre los archivos de programa que ha descargado para limitation exits for object graphics surfaces. su uso con este libro. Pulse y arrastre el cursor en la ventana de grficos para hacer girar el grfico de runla the program de FSC-Sutface, whichpropiedades is To see some the advantages are, superficie. Los what controles en of la barra de mens le ofrece oportunidad establecer muchas among the program files you downloaded to use with this book. Press and drag the de la superficie grafica, incluyendo el sombreado de parmetros, luces y colores. El programa de cursor in the graphics window to rotate the surface plot. Controls in the menu bar give FSC_Surface tiene una apariencia similar a la ilustracin en la Figura 13.

you the opportunity to set many properties of the surface plot, including shading parameters, lights, and colors. The FSC-Sulface program looks similar to the illustration Figure Adicinando colorina una13. superficie grfica

Adding Color to a Surface Plot A veces quieres aadir color a la superficie grfica para enfatizar ciertas caractersticas. Es
fcil deSometimes agregar color, usando de lasto mismas palabras clave que utiliz certain para darfeatures. color you wantmuchas to add color the surface plot to emphasize It is a grficas de lneas. (Los colores se discuten en detalle en la pgina 81 (Trabajar con colores easy to add color, using many of the same keywords that you used to add color to line en IDL). Por Ahora, slo tienes que escribir el comando TvLCT. Usted aprender exactamente plots. (Colors are discussed in detail in "Working with Colors in IDL" on page 8 1. For lo que el comando significa ms tarde. Bsicamente, usted est cargando tres vectores de command color now, just type the TvLCT command below. You will learn exactly what the que describen los componentes rojo, verde y azul de los colores triples que describen al carbn, means later. Basically, you are loading three color vectors that describe the red, green, amarillo y verde) ejemplo, para crear un grfico superficie de color amarillo yellow, sobre unand green and blue Por components of the color triplesde that describe the charcoal, fondo de carbn, tipee lo siguiente.: colors.) For example, to create a yellow surface plot on a charcoal background, type:

IDL> TvLCT, [70, 255, 01, 170, 255, 2551, [70, 0, 01, 1 IDL> Device, Decomposed=O IDL> Surf ace, peak, Color=2, Background=l

If quisiera you wanted the inferior underpart of the surface to be a different than the top, Si usted la regin de la superficie un color diferente al decolor la parte superior, Bottoln keyword like this: green, you can use the se puede utilizar la palabra clave Bottom as:
IDL> Surface, peak, Color=2, Background=l, Bottom=3

say

If you wanted axes todibujarse be drawn in a different color-green, for example-than the Si queras que los ejesthe se puedan de un color verdoso diferente, por ejemplo la surface, you have to enter two commands. The first command uses the NoData superficie, se tiene que introducir dos comandos. El primer comando utiliza la palabra clave NoData keyword that the axes are que drawn, while the second command the en surface para que slo losso ejes sejust dibujan, mientras el segundo comando representa ladraws superficie s 26de for a list of values can use itself with the axes turned off. Table 5 on una page con los ejes apagados. Ver Tabla 5 en la See pgina 26 para lista valores que puedeyou utilizar [XYZIStyle keywords what they mean. the clave con la with palabras [XYZ]Style y lo que and significan.
IDL> Surface, peak, Color=3, /NoData IDL> Surface, peak, / ~ o ~ r a s e Color=2, , Bottom=l, $

XStyle=4, YStyle=4, ZStyle=4

Custontiziltg Srirface Plots

Figure13: Programa Tlze FSC_Surface. Haga Click clic y arastre sobre la the ventana de grficos parato 13: Tlzede Figz~re FSC-Surface program. aizd drag in grapltics ~viitdow rotar la superficie grafica. Elsurface programa es escrito usando lais biblioteca clase deobject grficos de objeto. rotate tlzis plot. Tlze program written de usiizg the graplzics library. of tlze surface caiz be chaizged optioizs iiz the via Propiedades de class la superficie seProperties pueden cambiar por la via options en la barra de men.

meizzc bar.
Tambin es posible dibujar las lneas malla demesh la superficie en diferentes colores que representan It is also possible tode draw the lines of the surface in different colors representing different dataPor parameter. example, you can thinkcon of draping a second un parmetro de a datos diferente. ejemplo,For usted puede pensar en cubrir una segunda serie data over the first, coloring the meshdel of primer the first data set de datos sobre la primera, la coloracin de la malla conjunto de with datos con la informacin set the information contained in contenida enel segundo. the second. Para ver cmo funcionara esto, abra un conjunto de datos llamado Snow Pack y mostrarlo como un To see how this would work, open a data set named Snow Pack and display it superficie con estos comandos. Observe que el conjunto de datos Snow Pack es del mismo tamao surface with these commands. Notice that the Srzow Pack data set is the as a que el conjunto de datos mximo, una matriz de puntos flotante 41 por 41 . same size as

the peak data set, a 41-by-41 floating point array.

IDL> snow = LoadData (3) IDL> Help, snow IDL> Surface, snow
Ahora, se le colocan los datos en la variable snow a lo largo de la parte superior de los datos enthe la Now, you drape the data in the variable srzow the of the data in variable peak, utilizando los will valores de snow para dar color a la malla deover peak. Entop primer lugar, cargar some variable peak, usingcon the el values of srlow to color the mesh of se peak. First, load algunos colores en la tabla de colores comando LoadCT. El sombreado real realiza con done with colors keyword, in the color table with the LoadCT command. The actual shading is la palabra clave Shades, as: the Slzades like this:

Top=!D.Table-Size-l)
IDL> LoadCT, 5 either the Observe que tena que escalar el conjunto de datos Snow (con el comando BytScl) en cualquiera IDL> Surface, peak, Shades=BytScl(snow, table. de los nmero de colores que est usando en esta sesin IDL o el tamao de la tabla de colores. Si If you you to scale theun snow data de setejes (with the BytScl command) no logr escalar Notice los datos, eshad posible que vea conjunto y no presenten la superficieinto en This is shading number of colors you using in IDL de session orpara the size of the color absoluto. Es porque los datos deben ser are escalados enthis el rango 0 a 255 ser utilizado como to scale the you might see a set of axes and no surface display at all. el sombreado defailed parmetros para ladata, superficie.

because the data must be scaled into the range 0 to 255 to be used as the parameters for the surface.

Si~ttple Graphical Displays


A veces te gustara mostrar la superficie de color de acuerdo a la elevacin. Esto es fcil de hacer youde might like to surface colored according to elevation. This slo Sometimes mediante el uso los datos en display s como the el parametro sombreado.

is easily done just by using the data itself as the shading paranleter.
IDL> Surface, peak, Shades=BytScl(peak, Top=!D.Table-Size-l)

Modificando la the apariencia de un grfico de superficie Modifying Appearance of a Surface Plot


arede a palabras clave que puede you can use to appearance Hay There una serie apariencia o el or estilo de of un a number of keywords utilizar para modificar modify la the style surface plot. For example, you can display the surface with a skirt. Use the Skirt grfico de superficie. Por ejemplo, puede mostrar la superficie con un bordeado. Utilice la keyword to indicate the value where the skirt should be drawn. For example, try palabra clave Skirt para indicar el valor que debe establecerse el bordeado. Por ejemplo, pruebe these commands: estos comandos:
IDL> Surface, peak, Skirt=O IDL> Surface, peak, Skirt=5OO, Az=60
La salida del primer comando de arriba debe sershould similar look a la ilustracin de la Figura 14. in The output of the first command above similar to the illustration

Figure 14.

Figura 14: La grfica superficial una en la superficie. a bordeado 14: Figure The surface plotcon with skirt oiz the surface. Usted obtener una especie de "bordeado de appearance grafica de lineas" apariencia de horizontal dibujo de Youpuede can obtain a kind of "stacked line plot" by drawing only slo lneas horizontales. Por ejemplo, escriba: lines. For example, type:

IDL> Surface, peak, /~orizontal


Si lo desea, puede mostrar slo la superficie inferior o igual al superior y no tanto (que es el valor If you like, you can display just theclaves. lower Por or just the upper surface and not both (which predeterminado) las palabras ejemplo, escriba los dos comandos siguientes: is the default)utilizando using keywords. For example, type following

the

two commands:

IDL> Surface, peak, /upper-only IDL> Surface, peak, /~ower-Only A veces es posible desee extraer slo la propia superficie sin ejes: Sometimes you que might want to draw just the surface itself with no axes: IDL> Surface, peak, XStyle=4, YStyle=4, ZStyle=4

Creating Shaded Surfacegrficas Plots Creando Superficie sombreadas


is equally easy to crear create shaded surface plots of your data. shaded Es It igualmente fcil para grficas de superficies sombreadas con To suscreate datos. a Para crear surface plot using a Gouraud light source shading algorithm, type: un sombreado de la superficie utilizando un algoritmo de sombreado Gouraud fuente de luz , escriba:
IDL> Shade-Surf, peak

The Slznde-Sutfcommand accepts most ofpalabras the keywords acceptedpor by el the Surjnce El comando Shade_Surf acepta la mayora de las clave aceptadas comando command. So, for example, ifgirar you la want to rotate the shaded surface, you can type this: Surface. As, por ejemplo, si desea superficie sombreada, puede escribir esto:

Creatiitg Shaded Szirface Plots

Ax=30

El resultado debe ser similar a la ilustracin de la figura 15.

15.

Figura 15: Una de superficie sombrada de datos de elevacin uzando una light fuente 15: A grfica Figure shaded surface plot of the elevatioiz data usiizg a Gourazcd sozcrce de luz algoritmo de sombra Gouraud. shading algoritlzm.

Cambiando los parmetros de sombreado


Los parmetros de sombreado utilizados por el comando Shade-Surf se pueden cambiar con el with the Changing the Shading Parameters Comando Set-Shading. Por ejemplo, para cambiar la fuente de luz por defecto de [0,0,1], default of Az=45, The shading parameters used by the can changed en la que los rayos de que son light paralelos al eje Z, Slzade-Sutfcommand a [1,0,0], en el lato luz sonbe rayos inluz which the rays are parallel to the axis, in which the light [0,0,1], [1,0,0], Z que Your output should look similar to the illustration Set-Shading command. example, to change the light source from the paralelos alrays eje X, tipo: -S IDL> Shade u rf, peak, lo n , l a t , in Figure axis, type: are parallel to the X For

Tambin puede indicar que los ndices de [ la de colores se deben utilizar en el cuadro de color para Set-Shading, Light= l tabla , 0 , 01 IDL> Shade-Surf IDL> , peak suponga que desea cargar la Red de Temperatura efectos de sombreado. Por ejemplo, la tabla de colores (tabla de colores 3) en ndices de color del 100 al 199 y el uso de estos para el color You can also indicate which color table indices should be used from the color table for de sombreado. Usted puede escribir lo siguiente:

type shading purposes. For example, suppose you wanted to and load thethese Red Temperature color indices to 199 use for the shading color table (color table 100 3) into colors. You could this: IDL> LoadCT, 3 , NColors=100, Bottom=100
IDL> Set Shading, Values= [100, 1 9 9 1

IDL> shade-S u r f , peak Asegrese de establecer la ubicacin de la fuente de luz y de los parmetros de valor de color de nuevo Be sure to set the light source location and color value parameters back to their a sus valores originales, o se confundira en cuanto segamos mas adelante con los ejercicios.

original or you LoadCT, IDL>values, 5 will be confused as you move on with the exercises.
IDL> set-Shading,
Light= [ 0 , 0, l ], Values= [ o , ! D . able-size-l]

UsandoUsing otros conjuntos de datos para los valores de sombreado Another Data Set For the Shading Values
Al igual que Like con el comando Surface, otro conjunto de datos puede proporcionar los shading valores values with with the Su~face command, another data set can provide the de sombreado para colorear el primero. Al igual que antes, se utiliza la palabra clave specify the color which to color the first. As before, you use the Shades keyword toShades para especificar el of ndice de color on de the cada punto de la superficie. El sombreado cada pxel from the index each point surface. The shading of each pixel de is interpolated se interpola surrounding a partir de la los datos que lo rodean. Por ejemplo, es lothe que la variable silow variable looks like as data set values. For example, hereesto is what Snow mir como una superficie sombreada. Tipear lo siguiente: a shaded surface. Type:

IDL> Shade-Surf,

snow

Now use this set to shade the original elevation data. Type: Ahora usa este conjunto dedata datos para dar sombra a los datos de elevacin originales. Tipo:

Silnple Graphical Displays

IDL> Shade-Surf, peak, Shades=BytScl(snow,Top=!D.Table-Size)


El resultado debe ser similar a la the ilustracin de la Figura 16 Your output should look like illustration in Figure

16.

Figura 16: Los datos mximos de elevacin se oscurecer con el conjunto de datos snow. 16: Figure The peak elevation data shaded sizow data set. with tl2e Si desea sombrear la superficie de acuerdo a sus valores de elevacin, simplemente la escala byte If you want to shade the surface according to its elevation values, simply byte scale del conjunto de datos en s, escriba lo siguiente:

the data set itself, type this:

Cubriendo otro conjunto de datos sobre una superficie es una manera de aadir una dimensin extra Draping set over a surface a way to add an extra to your a su datos. Por another ejemplo, data cubriendo un conjunto deis datos en una superficie endimension tres dimensiones, que data. For example, by draping a data set on a three-dimensional surface, you are representan visualmente la informacin de cuatro dimensiones. Si se va a animar a estos dos conjuntos

IDL> Shade Surf, peak, Shades=BytScl(peak, Top=!D.Table-Size)

de datos a travs del tiempo que estara representando visualmente la informacin de cinco dimensiones. sets over time acerca you would be visually five-dimensional information. (Para data obtener informacin de la animacin derepresenting datos consulte "Animacin de datos de IDL" en la (To learn about data animation see "Animating Data in IDL" on page 102.) pgina 102.)

visually representing four-dimensional information. If you were to animate these two

Sometimes you just want to drape original surface on of the shaded surface. A veces se desea cubrir la superficie originalthe en la parte superior de latop superficie sombreada. Shade-Suifand Su$ace commands. For Por This is easy to do simply by combining the Esto es fcil de hacer, simplemente mediante la combinacin de los comandos Shade_Surf y surface. example, type: ejemplo, escriba: IDL> Shade Surf, peak IDL> surf ace, peak, / ~ o ~ r a s e

Creating Contour Plots de contorno Creando grficos


Cualquier conjunto de datos en dos dimensiones se puede mostrar en como un grfico Any two-dimensional data set can be displayed in a IDL contour plot with ade single IDL as contorno con un simple Comando Contour. utilizar la variable lo han in this Corztot~r command. You can use theUsted peak puede variable if you already peak havesi itya defined definido este Sesin deuse IDL. Si no es as, utilice el comando LoadData para cargar el conjunto LoadData command to load the Elevatior? Data data set, IDLen session. If not, the de elevacin,escriba lo siguiente: type this:

IDL> peak = LoadData (2) IDL> Help, peak


Estos datos pueden serviewed vistos como grficoplot de contorno con un command: solo comando: This data can be as aun contour with a single

IDL> Contour, peak, CharSize=1.5


Tenga en cuenta que si Coiztour el comando Contour nos da slo la nica matriz 2D comoas el an argumento deit Notice that if the command is given just the single 2D array argument grafica del conjuntos de datos es una funcin del nmero de elementos (41 en cada direccin) en el plots the data set as a function of the number of elements (41 in each direction) in the matriz 2D. Pero, como lo hizo antes con el comando de superficie, puede especificar los valores 2D array. But, as you did before with the Surface command, you can specify values para for los the ejesX X and e Y, Y que pueden fsico meaning para usted. Por ejemplo, puede utilizar axes thattener may significado have physical for you. For example, you los can vectores longitudinales y latitudinales, de esta manera: use the longitudinal and latitudinal vectors from before, like this:

Creating Contolir Plots

Figura 17:17: UnaA grafica contorno bsico de data. los datos. Notece que de los ejesrepXeY Figure basicde corttozcr plot of the Notice that tlzelas artd Y axis labels X etiquetas ~zzcmber of elemertts irz tlze data array. representan el resent nmerothe de elementos en la matriz de datos.

IDL> lat = FIndGen(41) * (24./ 4 0 ) + 24 IDL> lon = FindGen(41) * 5 0 . 0 / 4 0 - 122 IDL> Contour, peak, lon, lat, XTitle='Longitudel, $ YTitle='Latitudel
Notar que los the ejesaxes son autoescalados. Usted puede como En primer lugar, Notice that are being autoscaled. You decidir can tell this asociarlas. in a couple of ways. First, el contorno delines Iineas No puede ir en bordes grficas, y usted ver que the contour do not go to thelos edges of del the contorno contour de plot, and you can puede see that the las etiquetas losaxes ejes are no son con los valores mnimo y mximo values del vector lat. labels on the notlas themismas same as the minimum and maximum of lon theylor~

and lnt vectors.


IDL> Print, Min(1on), Max(1on) , Max (lat) IDLz Print, Min (lat)

YStyle To prevent autoscaling of ejes, the axes, setpalabras the XStyle andXstyle keywords, like this: Para evitar autoescala de los use las claves y YStyle, como esto:
IDL> Contour, peak, lon, lat, XTitle='Longitudel, $ YTitle='Latitudel, XStyle=l, YStyle=l
Usted verthe el resultado este comando en la Figura 18. in You see result of de this command in the illustration

Figure 18.

-120 -l 10

-100

-90

-80

Longitude
Figura 18:18: UnaA grfica de contornos ejes representando cantidades fsicamente significativas. Figure contozcrplot withcon axes representing physically meanirzgful quantities.

37

Sinzple Gi.aplzical Displays

In earlier versions IDL, the Corztour command what was called the cell En versiones anteriores deof IDL, el comando Contour utiliza loused que se llama el "cell drawing method" drnvvilzg r.tzetlzod of calculating and drawing the contours of the data. In method y dibujo de los contornos de los datos de dibujo. En este mtodo la curva de nivel quethis se extrae de la contour plot was drawn a from the superior. bottom of themtodo contour plot to thepero top. no This parte the inferior del grfico de contorno la parte Este era eficiente, permitia method was efficient,de but it didn't allow options like contour labeling. cell opciones como el etiquetado contorno. La "cell following method" se usaba para The dibujar cada lnea follo~ililzg lnetlzod was used to draw each contour line entirely around the contour de contorno completo alrededor del grfico de contorno. Esto tom ms tiempo, pero permite unplot. mayor This took more time, but allowed more control over the contour line. la For example, ituna control sobre la lnea de contorno. Por ejemplo, se podra interrumpir para permitir colocacin de could be interrupted to allow the placement of a contour label. The cell following etiqueta de contorno. La "cell following method" podra ser seleccionado con la palabra clave Follow: method could be selected with the Follow keyword:
IDL> Contour, peak, lon, lat, XStyle=l, ~ S t y l e = l ,/ ~ o l l o w
A partir de IDL in 5 el comando contour siempre se utiliza el uses "cell following method" para dibujar 5 the contour Starting IDL command always the cell following method tocurvas draw de nivel, por lo que palabra clave Follow es obsoleta. But Sin embargo, seits utiliza por su efecto contours, so la the Follow keyword is obsolete. it is still todava used for beneficial sidesecundario de etiquetar cada lnea de contorno de forma automtica. effectbeneficioso of labeling every other contour line automatically.

Seleccionando Niveles de contorno Selecting Contour Levels


De forma IDL selecciona seis intervalos regularmente espaciados de contorno By predeterminada, default, IDL selects six regularly spaced contour intervals (five contour lines) to (cincocontour, curvas de nivel) para contornos, pero puede cambiar esto de varias maneras. Por ejemplo, but you can change this in several ways. For example, you can tell IDL how usted many puede contour decir cmo IDL dibuj muchos de contorno con la palabra NLevels. levels to draw with niveles the NLevels keyword. IDL will clave calculate that IDL calcular el nmero de intervalos de contorno espaciados. Por ejemplo, number of regularly spaced contour regularmente intervals. For example, to contour apara datael set with contorno de un conjunto de datos con los 12 contornos regularmente espaciados, escriba: 12 regularly spaced contours, type:

IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l, / ~ o l l o w ,$

NLevels=12

Your output should similar tode the in Figure You choose El resultado debe ser similarlook a la ilustracin la illustration figura 19. Usted puede 19. elegir un can mximo de up 29 contour levels. 29 niveles de contorno

to

Figura 19: Una de contornowith con el nmero de los niveles de contorno 12. Nota que cada dos 19:grfica 12. Figure A corztourplot the izzlmber of contour levels set a to Note that evel nivel de contorno rotula. Esto eslevel un de lateral de is usar la palabra clave Follow. isefecto labeled. This a side-effect of zcsiizg the Follow eryse other contour

keyword.
Desafortunadamente, a pesar de la documentacin IDL, afirma que IDL se seleccione un determinado nmero de intervalos de contorno "equidistantes", esto no puede suceder. Unfortunately, although the IDL documentation claims IDL will de select Si usted busca cerca el grfico de contorno que acaba de hacer, tethat dars cuenta que a specified number of "equally spaced" contour intervals, this may not happen. If you es menos de 12 niveles que es calculado por IDL. Al parecer, el valor de palabra clave look closely the como contour you just por made, you will notice thatafewer than 12 levels are NLEVELS se at utiliza unaplot "sugerencia" el algoritmo de contorno seleccionar en IDL. calculated by IDL. Apparently, the NLevels keyword value is used as a "suggestion" Por lo tanto, la mayora de los programadores IDL eligen para calcular los niveles de contorno by the contour-selecting algorithm in IDL. a s mismos.

Thus, most IDL programmers choose to calculate the contour levels themselves. For example, you can specify exactly where the contours should be drawn and pass them

Modifying n Coi~torii. Plot


Por ejemplo, puede especificar exactamente donde los contornos deben elaborarse y pasarlas to the Contoui-command with the Levels keyword, rather than with the NLevels al comando Contuor con la palabra clave NLevels, como esto:

keyword, like this:

IDL> vals = [200, 300, 600, 750, 800, 900, 1200, 15001 IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l, /Follow, $ Levels=vals

To choose spaced contour intervals, you can puede write code something like as: 12 equally Para elegir 12 intervalos de contorno igualmente espaciodos , usted escribir el cdigo algo this:
IDL> IDL> IDL> IDL>

nlevels = 12 step = (Max(peak) - ~ i n ( p e a k)) / nlevels vals = Indgen(nleve1s) * step + Min(peak) Contour, peak, lon, lat, XStyle=l, YStyle=l, /Follow, $ Levels=vals

Si usted puede especificar exactamente que contornos lneas deberan ser etiquetado con la youC_Labels like, you can specify contour line should be labeled with the palabra If clave . Esta palabra exactly clave es which un vector con muchos elementos como contorno C-Labels keyword. This keyword is a vector with as many elements as there are de lneas. (Si el nmero de elementos no empareja al nmero de contorno lneas, los elementos contour lines. (If the number of elements does not match the number of contour no pueden ser removidos por ello se hace a veces con otro palabras clave contuor.) Si el valor lines, the elements do not get re-cycled like they ), sometimes docontorno with other contour si el del elemento es 1 (O ms precisamente, si es positivo la etiqueta de es dibujado; keywords.) If the value of the element is 1 (or more precisely, if it is positive), the valor de la elemento es 0, el contorno de etiquetas no es dibujado. Si no hay valor en particular contour label is drawn; if the value of the element is 0, the contour label is not drawn. para el contorno de linea, la lnea no es etiquetada. Por ejemplo, para etiquetar el primero, tercero, If there is no value for a particular contour line, the line is not labeled. For example, to sexto y sptimo contorno linea,sixth escribir: label the first, third, and seventh contour line, type:

IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l, /Follow, $ Levels=vals, C-Labels= [l,0, l, 0,O ,1 , 1 , 01
Para etiquetar todo elthe contorno lneas, usted el Replicate comando Replicate para To label all contour lines, youpodra couldutilizar use the command toreplicar replicate the el valor 1 muchas veces como usted necesite. ejemplo, escriba value 1 as many times as you need.Por For example, typeesto: this:

IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l, /Follow, $ Levels=vals, C-Labels=Replicate(l, nlevels)

Modificando un Contorno Grfico Plot Modifying a Contour

Un contorno grfico puede ser modificado con la misma palabras clave usted ha utilizado con los

comandos y Surface .Pero ahi tambin with un nmero de palabras claves que podria slo contour plot can be modified the same keywords you used for aplicar the Plot and A Plot al comando contour . Estos ms a menudo modificar el contorno a s mismos. Suiface commands. But there are also a number of lneas keywords that apply only to the

Contour command. These most often modify the contour lines themselves.
Por ejemplo, para anotar un contorno grafico con eje ttulados, usted puede escribir esto:

For example, to annotate a contour plot with axis titles, you can type:

IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l, /Follow, XTitle='Longitudel,YTitle='Latitudet, $ CharSize=1.5, Title='Study Area 13F8g1, NLevels=lO

But,puede you can also especificar specify annotations on the contour lines themselves by using the Pero, usted tambin anotaciones en los contornos lneas asi mismos usando keyword. For example, you could label cada eachcontorno contourlnea line with a string la clave C-Anizotatior~ palabra C_Annotation. Por ejemplo, usted podra etiquetar con un by typing: etiquetalabel de cadena escribiendo:
IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l, / ~ o l l o w ,$ $ XTitle=lLongitudel,~~itle='Latitude', CharSize=1.5, Title='Study Area 13F89', $ C-Ann~tation=[~Low~,'Middle','High'], $ Levels=[200, 500, 8001
Su salida debe ser similar a la ilustracin en La Figura 20.

Your output should look similar to the illustration in Figure 20.

Changing Appearance of a Contour Plot Grfica Cambio la the Apariencia de un Contorno


Ah cualquier nmero de formas a modificar la apariencia de un contornos grficas. Aqu son few of them. One chasacteristic you can change is the style of the contour lines. (See unos pocos de ellos. Una caracterstica es que usted puede cambiar este estilo de contorno lneas.

There are any number of ways to modify the appearance of a contour plot. Here are a

Silnple Graplzical Displays

Study Area 13F89


4
30
a,

"

'

'

'

'

'

.S
C . '

20 10 0 I . . . . . . . . . . . . . . . . . . , . d.'?m,, 0 30 10 20 Longitude
b

(6

. . , . .:

40

Figura 20: Lineas de Contornos pueden ser rotulados con yozc texto que usted proporciona. Figzcre Corttoui. lines cart be labeled with text provide yourself. 20:

Table for un a list ofde possible line style values.) For.)example, to make contourde lines (Ver la Tabla 33 para lista posibles valores de estilo lnea Por ejemplo, hacer the el contorno lneas discontinua, tipear: dashed, type:
IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l, $

/ ~ o l l o w ,C_LineStyle=2
Si ustedIf desea cada tercera lnea discontinua, podra especificar un vector de ndices de you wanted every third line to beusted dashed, you could specify a vector of line style estilo lnea con la palabra clave C_LineStyle . Si estos contornos de lneas son ndices, el ndices indices with the C-Linestyle keyword. If there are more contour lines than indices, the puede ser reciclado obe utilizado. Tipear: indices will recycled or used over. Type:

IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l, / ~ o l l o w ,$

NLevels=9, C_LineStyle=[0,0,2]
Su salida debera ser should similar a la ilustracin en La illustration Figura 21. in Figure Your output look similar to the

21.

Figura 21: Puede muchos aspectos grafico de contorno. cada tercer 21: Figure Yozc modificar can rnodifi many aspectsde ofun a contourplot. Here Aqu every third contour lirte is drawit en in un a dashed style. curva de nivel es contrada estilo deline lnea de rayas. El grosor deThe las lneas de contorno puede tambin ser also cambiado. Por ejemplo, para hacer que thickness of the contour lines can be changed. For example, to make todas las curvas de nivel doblen su espesor, tipear esto: contour lines double thick, type:

all

IDL> Contour, peak, Ion, lat, XStyle=l, YStyle=l, $

Modifying n Contozcr Plot

You could every other line thick by a vector of line thicknesses, like Usted podra hacer make otra lnea grueso especificando un specifying vector de lnea de espesores, as: this:
IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l, $ NLevels=12, C-~hick=[1,2], /Follow Usted puede modificar el contorno grfico as que usted puede ver fcilmente la direccin.
Por ejemplo, tipeartype: : example,

You can modify the contour plot so that you can easily see the downhill direction. For
IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l, $ / ~ o l l o w ,NLevels=12, ownhi hill

Su salida debera ser should similar a la similar ilustracin Figura 22. Your output be to en the illustration

in Figure 22.

Figura 22: La palabra clave Downhill es unis conjunto que muestra la direccin del contorno 22: Figure The Do~vizhill keyword set to show the do~v~thill direction of thegrfico. con-

tour plot.

Agregando Color un Contorno grfico Adding Color para to a Contour Plot


Ah muchas formas a aadir color a add un contorno grfico. (Colores discutido detalle en There are many ways to color to a contour plot.son (Colors are en discussed inIDL detail in "Trabajo con Colores en IDL " en pgina 81. Por ahora, slo usaremos el siguiente comando TvLCT. "Working with Colors in IDL" on page 81. For now, just type the TvLCT command Usted entendera exactamente qu es lo que hace el comando ms adelante. usted below. You will learn exactly what the command means later.Bsicamente, Basically, you are esta cargando tres vectores de colores que describen al rojo, verde, y azul componentes del color loading three color vectors that describe the red, green, and blue components of the triples que describen a that los colores carbn, amarillo, y yellow, verde.) Por si quisieras amarillo if de color triples describe the charcoal, andejemplo, green colors.) For un example, you contorno grfico con un fondo carbn, usted tipee esto: want a yellow contour plot on a charcoal background, you can type:

IDL> TvLCT, [70, 2551, 170, 2551, [70, 01, 1 IDL> Device, Decomposed=O IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l, $ NLevels=lO, Color=2, Background=l, / ~ o l l o w

Youtambin can also color the individual contour lines using the C-Colors keyword. For Usted puede colorear individualmente el contorno lneas usando la palabra clave C_Colors. example, ifdeseado you wanted the contour in the plot above to be drawn green, you Por ejemplo, si usted que el contorno de lines lneas en la grafica de arriba en verde,in usted can type: puede tippear:
IDL> TvLCT, 0, 255, 0, 3 IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l, / ~ o l l o w ,$ NLevels=lO, Color=2, ~ackground=l,C_Colors=3
La palabra clave C_Colors puede tambin ser expresado como un vector de tabla table de ndices de color, C-Colors The keyword can also be expressed as a vector of color indices, which

will be in aen cyclical fashion draw the contour lines. For el cual puede ser used utilizado una moda cclicato para dibujar el contorno lneas.

example, you can use

Siirrple Graphical Displays


Por ejemplo, usted puede utilizar el comando Tek_Color para crear ycolors cargar for dibujos de colores the Tek-Color command to create and load drawing the contour lines, like para el contorno lneas, as: this:

IDL> Tek Color IDL> TVLCT, [70, 2 5 5 1 , [70, 2 5 5 1 , [70, 0 1 , 1 IDL> Contour, peak, lon, lat, XStyle=l, YStyle-l, $ NLevels=lO, Color=2, Background=l, $ C-Colors=IndGen (10) +2, / ~ o l l o w
Esto es tambin fcil a utilizar la palabra clave C_Colors pone tercera contorno en blue, azul, It is also easy to use the C-Colors keyword tocada make everylnea thirdde contour line mientras que el resto son verde. Por ejemplo, tipee esto: while the rest are gseen. For example, type:

YStyle=l, , IDL> Contour, peak, lon, lat, ~ ~ t y l e = l $ NLevels=12, Color=2, ~ackground=l,$ C Colors= [3, 3, 41 , / ~ o l l o w

Creando Llenado dePlot Contorno Grfico Creating un a Filled Contour


Sometimes you don't want to see contour lines, but you would to see a filled A vecescontour usted noplot. quiere ver contorno lneas, pero usted le gustaria ver un contorno delike grfica lleno. To create a just filled contour plot, just use the keyword. Here you first F i l l Para crear un llenado de contorno grafico, slo utilizar la palabra clave Fill. Aqu usted primero carga load 12 colors into the color table for the fill colors. The color indices will be specified 12 colores enthe la color tabla para el llenado de colores. Los ndices de colores se pueden especificar with C-Colors keyword. For example, type:
con la palabra clave C_Colors. Por ejemplo, tipear esto: IDL> LoadCT, 0 IDL> LoadCT, 4, NColors=12, Bottom=l IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l,

ill, $

NLevels=12, / ~ o l l o w ,C-Colors=Indgen(l2)+1
Aunque no es obvio mostrar, all un problema como hacer contornos rellenos en este manera. De Although it is not obvious from the display, there are problems with doing filled hecho, hay un "Hole" en este contorno grfico con el fondo color lleno. Usted podia ver fcilmente contours in this manner. In fact, there is a "hole" in this contour plot that is filled with el fondo y el trazado de colores. (Esto es hecho en PostScript y qu hace que muchos programadores the background color. You can see it more easily if you reverse the background and IDL tiren su cabello de frustracin.)

plotting (This is what done in Postscript, as a matter of fact, and what causes many colors. IDL programmers tois pull their hair in frustration.)

23: Figure The coiztourplot showing the "hole" al atnivel the lowest corztour Figura 23: El grfico de contorno mostrando el "agujero" de contorno ms level. bajo.
IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l,

ill, $

Creating n Filled Coiztoztr Plot

La The razn para que hueco es IDL llena lathe espacio entre la primero y segundo lneascontour de reason forel the hole isque that IDL fills space between the first and second contorno con el primero llena color. Lo hara parecer ms sentido a llenar el espacio entre lines with the first fill coloc It would seem to make more sense to fill the spaceel cero (O between fondo) y el primer con la primer de color. with Para conseguir que IDL haga the 0th contorno (or background) and llena first contour the first fill color. But lo toque get usted teniene especificado hacer sus propios contornos de intervalos y pasarlos con el comando IDL to do that you have to specify your own contour intervals and pass them to the contour con la palabra clave Levels . Esto keyword. es en general hecho con cdigo Contour command with the Levels This is usually donecomo with esto: code like this:

IDL> step = (Max(peak) - Min(peak) ) / 12.0 IDL> clevels = IndGen (12) *step + Min (peak) Ahora usted conseguio el contorno lleno de colores correcto: Now you get the contour fill colors correct:

En en general, es una bueno idea siempre suXStyle=l, propio contorno niveles cuando usted estn $ peak, lon,definir lat, YStyle=l, /Fill, IDL> Contour, trabajando con llenado de contorno grficos. Por otra parte, si usted muestra su llenado de $ Levels=clevels, /Follow, C-Colors=Indgen(l2)+1, Background=!P.Color, Color=!P.Background contorno grficos con barra de color, layour creacin de su propio niveles contorno es slo la manera plots along with auna color bar, creating own contour levels is the only way to make desure cerciorarse de su contorno de niveles y que los niveles de la barra de color sean idnticas. that your contour levels and the color bar levels are identical.

In general, it is a good idea to always define your own contour levels when you are working with filled contour plots. Moreover, if you are displaying your filled contour

Figura 24:24: La misma grfica de contorno, los niveles calculados y especificados Figure The same contour plot,pero bzct con with the levels calculated aizd specified didirectamente. El agujero es llenado ahora y el nmero correcto de niveles el aparente rectly. The hole is no~v is apparertt filled and the correct nzcinber es of levels en el grfico. iiz the plot. A veces Sometimes usted quiereyou llenar a voluntad contorno grfico faltan datos o contornos para that will want toun fill a contour plot que thatle has missing data or contours ampliar el borde off de los Estos son These llamado contornos abiertos. IDL a veces extend thecontorno edge of grficos. the contour plot. are called opelz colztours. IDL puede can tener dificultad con contornos abiertos. La mejor de llenar contornos de este tipo, es a utilizar sometimes have difficulty with openmanera contours. The best way to fill contours of this la palabra clave en ves de la palabra clave Fill. than Este causas que el comando contour utiliza type, isCell_Fill to use the Cell-Fill keyword rather the Fill keyword. This causes the un algoritmo de llenado de celdas, eficiente como el algoritmo por la palabra Contour command toque useno a es cell filling algorithm, whichutilizado is not as efficient as clave the Fill, pero que nos da mejor resultados bajokeyword, estas circunstancias. algorithm used by the Fill but which gives better results under these

circumstances.
IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l, $

Levels=clevels, C-Colors=1ndgen(l2)+1,

/cell-Fill

La palabra clave Cell_Fill debera tambin ser utilizado si usted quiere llenar su contorno grfica putting your filled contour plots en el mapa de proyecciones. De lo contrario, los colores de contorno pueden ser a veces incorrectos. sometimes be incorrect. La algoritmo de llenado de celdas a veces daos al eje de contornogrficos. Usted puede repararlos contour plot axes. You can repair dibujando el contorno de graficos encima de nuevo sin la datos. Como esto:

the data. Like this:

YStyle=l, $ / N o ~ r a s e ,/F'ollow
A veces usted quiere ver el contorno lneas superior de contornos llenos de color. Es fcilmente de logrado en IDL con la palabra clave Overplot para el comando Contour. Por ejemplo:

the color-filled contours. This keyword to the Contoul-command.

IDL> Contour, peak, lon, lat, XStyle=l, YStyle=l, $

Levels=clevels,

ill, C Colors=IndGen(l2)+1

IDL> Contour, peak, lon, lat, ~ ~ ~ ~ l YStyle=l, e = l , / ~ o l l o w ,$

Levels=clevels, /Overplot
Su salida debera ser similar la ilustracin Figura 25. in Figure Your output should look a similar to theen illustration

25.

Figura 25: Una de contorno conthe el contorno de lineas overplot encima deof los contornos llenos. 25: grfica A contour Figztre plot with contozcr lines overplotted oiz top the filled conNo confundir la palabra clave Overplot con la palabra clave NoErase . Ellos son similares, pero sin duda no la misma. En un contorno grfico, la palabra clave Overplot seala slo a la lneas Siirtple Grapltical Displays de contorno, no los ejes de contorno. La palabra clave NoErase dibuja todo el contorno grfico Overplot NoErase Don't confuse the keyword with the keyword. They are similar, but definitely not the same. a contour plot, the Overplot keyword draws the contour sin borrar primero la qu ya In esta mostrada.

tours.

withoutde first erasing what is already on the display. The keyword should also be used if you are Cell-Fill Posicionamiento Salida Grfico en la Ventana Mostrada on map projections. Otherwise, the contour colors will The cell filling algorithm sometinles damages the Positioning Graphic Output in the Display Window Salidas Grficas en la Ventana grficas ( por ejemplo mapa proyecciones). Para entender cmo
IDL tiene varios formas a posicin lnea grficas, superficie grficas, contorno grficas y otras IDL posiciona grficas, es importante comprender un poco mas las definiciones. La posicin grfica IDL has several ways to position lineIDL> plots, surface plots, contour plots La and other Contour, peak, XStyle=l, es la ubicacin en la ventana mostrada que es adjunto por los ejes de la lon, grfica.lat, posicin grfica graphical plots (map projections, for example) in the display window. To understand Levels=clevels, / N o ~ a la ta , no incluye el etiquetado de los ejes, ttulos, o otras anotacines (Vase a continuacin Figura 26 ). how IDL positions graphics, however, it isvisualizacin important to understand a few definitions. La regin grfica es la porcin de la Ventana de que incluye la grfico posicin, pero Sometimes you want to see theis contour lines on in theposicin display window that enclosed by thetop of The graphic positiorl is that location tambin incluye el espacio alrededor del grfico accomplished para tal cosas como etiquetar ejes, graficas is easily in IDL with the Overplot axes of the plot. The graphic position does not include axes labels, titles, or other y ttulos de los ejes, etctera. El margen grfico es definida For example, type: como la rea en la que se muestra la ventana que es no la grfica de posicin. window that includes the graphic position, but it

lines only, rzot the contour axes. The NoEmse keyword draws the entire contour plot

them by drawing the contour plot over again without

annotation (see Figure 26 below). The graplzic region is that portion of the display also includes space around the graphic position for such things as axes labels, plot and axes titles, etc. The graphic El grfico de posicin puede ser establecido por un sistema variable ! P.Position o por la Palabra margin is defined as the area in the display window that is rzot the graphic position.
clave Position para los comandos Plot, Surface, Contour, o cualquier otro comando grfico IDL.

The graphic position may be set by !l?Positiolz system variable or by the Positiol? keyword to the Plot, Surface, Corztour, or any of the other IDL graphics commands.

Positiorzing Gt.aplzic Ozctpzct in tlze Display Window

Posicion Grfica

Reguin Grfica

Margen Grfica Graphic Margin

Figura 26:26: La grfica de posicin es la rea mostrada por los ejes del La regin Figzcre The graphic positiorz is tlze area of adjuntada tlze display erzclosed by grfico. the axes of the grfica es similar, pero tambin contiene espacio para ttulos y otros anotaciones. El margen the graphic. The graphic region is sirttilar, but also corztairzs space for grfico other The margin is jzcst tlze graplzic's titles and es justo lo opuesto de la posicin grfica. El artrzotatiorz. margen grfico es graphic especificado en unidades de opposite the graphic The son graphic marginen isunidades specified iiz charcarcteres,mientras laof posicin grfica positiorz. y regin grfica especificado coordenadas normalizadas. acter z~rzits, whereas the graphic position alzd graphic region are

specified irz norinalized coorditzate zcnits.

Toda la regin grfica puede ser establecida por el sistema variables ! P.Region , o regiones enejes The entire graphic region may be setel by the !P.Regiorz system variable, or regions individuales puede ser establecido mediante campo de la regin del sistema variables !X, !Y, on y !Z. individual axes be establecido set using the field to the variables. canser !X, !k: andpara !Z system El mrgen grfico puede porRegioiz la palabras clave [XYZ]Margin los comandos Plot, TheContour; graphic o margins may be grficos set by the keywords to the [XYZIMnrgirz Surfice, Surface, otros comandos IDL o por el campo de margenes delPlot, sistema variable or other IDL graphics command or by the Mnrgi1.1field in the !X, !I: and !Z Corztoui; !X, !Y, y !Z.

system variables.
Por defecto, el conjunto de margen grfico IDL cuando intenta poner un grfico en la ventana de By default, IDL sets the graphic margin when it tries to put a graphic into the display visualizacin. Pero, como usted visualiza, que no es siempre la mejor eleccin. A veces es mejor window. But, as you will see, that is not always the best choice. It is sometimes better utilizar la grfica de posicin para posicinar su grficos en pantalla, especialmente si usted combina to use the graphic position to position your graphics displays, especially if you are grficos de salida con los comandos en la ventana de visualizacin.

combining graphics output commands in one display window.

Sin~ple Graphical Displays

Setting thelos Graphic Margins Grficos Ajustando Mrgenes


La grfico mrgenes puede ser establecida con la palabras clave [XYZ]Margin en el comando Z system variables. What is and ! command or by setting the Margirz field of the !X, grfico o por el ajuste del campo de Margenes del sistema de variables !X, !Y, y !Z. Qu es unusual about the graphic margins is that the units are specified in terms of character inusual acerca de los mrgenes grficos que las unidades son especificadas en condiciones size. The X margin is set by a two-element vector specifying the left and right offsets, del tamao de la fuente (CaharSize). El margen X es especificando por un vector de dos elementos respectively, of the axes from the edge of the display. The Y margin specifies the a la izquierda y derecho, respectivamente, de los ejes de borde para mostrar. El margen Y bottom and top offsets in a similar way. The default margins are 10 and 3 for the X especifica la compensaciones para la parte inferior y superior de manera similar. El defecto de mrgenes axis and 4 and 2 for the Y axis. To see what the current character sizes are in device or son 10 y 3 para la Eje X y 4 y 2 para el eje Y. Para ver qu el tamao de caracteres corra debe de estar en pixel type: en unidades units, de pixel, tipo: IDL> Print, !D.X-Ch-Size, !D.Y -Ch-Size En una Macintosh, por ejemplo, el carcter de tamao por defecto es 6 pxeles en X y 9 pxeles en On a Macintosh, for example, the default character size is 6 pixels in X and 9 pixels in Y. Por lo tanto, un contorno grafico es dibujado con (6 veces 10) 60 pxeles en su borde izquierda Y. Thus, a contour plot is drawn with (6 times 10) 60 pixels on its left edge of the plot de la grfica y (6 veces 3) 18 pxeles en su borde derecho. Si la palabra clave CharSize es and (6 times 3) 18 pixels on its right edge. If the ChalSize keyword is set to 2 on a establecida a 2 en un comando contour, por ejemplo, entonces ayi hay 120 pxeles en la borde Contour command, for example, then there will be 120 pixels on the left edge of the izquierdo de la trama y 36 en la derecho borde.

The graphic margins can be set with the [XYZIM~J-gin keywords in the graphics

!X

plot and 36 on the right edge.

Por ejemplo, para cambiar los mrgenes grficos a tres to unidades de carcteres por units defecto todo For example, to change the graphic margins three default character all the el way camino alrededor grfico, usted hara lo siguiente: around thedel plot, you would type:

IDL> Plot, time, curve,

margin= [3,3],

margin= [3,3]

Notese, Sin embargo, que that la grfica parece muy diferente si cambiamos el tamao la character fuente, Notice, however, the plot looks very different if you also changede the los mrgenes grficos son especificados en condiciones del tamao del carcter. Prueba esto: size, since graphic margins are specified in terms of character size. Try this:

IDL> !X.Margin = [3,3] D L > !Y.Margin = [3,31 IDL> Contour, peak, CharSize=2 . 5 IDL> Contour, peak, CharSize=l . S Si usted jugar alrededor de un bit con otro tamaode carcter, usted puede ver que en mayor If you play around a bit with other character sizes, you can see that at larger character tamaos de caracteres,el caracter conseguido es muy grande y la porcin grficas de la sizes, the characters get very large and the graphics portion of the plot gets very small. pantalla es muy pequea. Este es no Siempre lo que desea.

This is not always what you want.

Asegrese a establecer los graphic mrgenes grficos detras su valores defecto antes usted siga on. Be sure to set the margins back tode their defaultpor values before you move adelante. Tipee: Type:

Unlike many other system variables, whosecuyo values are set to theantes default values Desasemeja muchas otras variables del sistema, valores sonback establecer los valorespor setting el the system variable to margin system variables variables must be set defectoby ajustando sistema de variableequal igual a 0,0, el the margen del sistema debe ser establecido explicitly to their default values. If you didn't type the two commands above, be sure explcitamente a valores por defecto. Si usted no lo hizo tipee los dos comandos por encima de snow. to do it now.

Ajustando Posicin Grfica Setting thela Graphic Position


Ajustando la posicin grfica position requiere dar un ajuste en cuatro vectores devector elementos , en orden, Setting the graphic requires setting a four-element giving, in order, the las coordenadas [X0,[XO, Y0, X1, Y1] inferior y la esquinas superior derecha del graphic grfico in of the lower-left and upper-right corners of the YO, XI,de Y la l ]izquierda coordinates a mostrar. coordenadas son siempre expresadas en unidades normalizadas que van de 0a1 the Estas display window. These coordinates are always expressed in normalized units (Es decir, 0 es siempre lato izquierda o el de either la ventana mostrada, 1 es siempre derecha o is fondo always the left or the y bottom of thela display 1 (i.e., 0 ranging from 0 superiorwindow, de la ventana mostrada). is always either the right or top of the display window). and 1

For example, suppose you su wanted graphic output to be in the top Por ejemplo, suponer usted deseado salidayour grfica ser desplegado en eldisplayed medio superior de la half system variable and !P.Positioiz of the display window. Then you might set the ventana mostrada. Entonces usted fuerza la variable del sistema con ! P.Position y mostre su grfico display your graphic like this: como esto:
IDL> !P.Position = L0.1, 0.5, 0.9, 0.91 IDL> Plot, time, curve

Positiorziizg Graphic Ozitplct in the Display Wii~do~v

Allsalida subsequent output will be positioned similarly. ToPara reset the ! R Position Toda grfica graphics posterior puede ser posicionado de manera similar. reajustar la variable system variable so that subsequent graphic output the window normally, type: del sistema ! P.Position posterior a la grfica de salida de fills la ventana normalmente, tipee:
SiIf usted posicinar slojust uno one pantalla grfica, usted you podra especificar un youqueria wanted to position graphic display, could specify a posicin graphicgrfica

position with thePosition Position keyword to the graphics command. Suppose you wanted con la palabra clave con el comando graphics. Supongo que usted a deseado slo un a contour plot to just fill up the left-hand side ofventana a display window. You puede mighttipear type esto: this: contorno grfico lleno hasta el lado izquierdo de una mostrada. Usted
IDL> Contour, peak, position= [O.l, 0.1, 0.5, 0.91
Nota que la palabra clave Position puede utilizado para mltiplesgraphics grficos en lo mismo ventana Note that the Positiolz keyword can ser be used to put multiple plots into the de visualizacion. Slo este seguro utilizar la palabra clave NoErase y todas las second posteriores same display window. Just beasure to use the NoEl-ase keyword on the and all comandos grficos . Usted evitar borrar primero ventana de display visualizacion, cual es por defecto subsequent graphics commands. This willla prevent the from el being erased first, is the default behavior for all graphics output commands exceptPor and TVScl. TV el which comportamiento para todo grfico salida excepto los comandos TV y TVScl. ejemplo, para For example, put a line plot above a contour plot, you can tipear: type: mostrar una lneato grica arriba con un contorno grfico, usted puede

IDL> Plot, time, curve, ~osition=[O.l,0.55, 0.95, 0.951 0.1, , 0.95, 0.451, / ~ o ~ r a s e IDL> Contour, peak, ~ o s i t i o n = [ ~ . l

Setting the Graphic Region Ajuste la Regin Grfica


The graphic region is specified in normalized coordinates the same way as the La regin grfico es especificada en coordenadas normalizadas de lain mismo manera como la graphic position, and can be specified by setting the !PRegiorz system variable. Since Posicin grfica , y puede ser especificado ajustado por la variables sistema ! P.Region . Puesto there is not an equivalent keyword that can be set on a graphics command, setting the que no hay una palabra clave equivalente que pueda ser establecer en un comando grfico,ajustar graphics region is often less convenient than setting the graphics position. Be sure you las regines grficos a menudo menos conveniente de ajustar las posicines grficas. Usted puede reset the systemsistema variable you quiere want subsequent plots to use whole resetear las variables siif usted posteriormente grficas a the utilizar todadisplay Ventana de window normally. For example, to display a plot in the upper two-thirds of your visualizacin normalmente. Por ejemplo, mostrar una grfica superior con los dos tercios de la display window, type: ventana de visualizacin , tipo:
IDL> !P.Region = [0.1, 0.33, 0.9, 0.91 IDL> Plot, time, curve Para reajustar las variables del sistema use la palabre clave !P.Region as posteriormente el To reset the !PRegiorz system variable so that subsequent plots fill the window llenado grfico de la ventana es normal, tipee:

normally, type:

IDL> ! P.Region = 0

Creando Mltiples Grficas Creating Multiple Graphics Plots


Como usted puede ver, puede posicionar mltiples graficas y regin grfica de las variables del As you can see, multiple plots(Como can be positioned onel the display using the graphic sistema y palabras claves discutidas siempre cuando segundo y el posterior grafico position and graphic region system variables and keywords discussed above (as long utilizan la palabra clave NoErase ). Pero es mucho ms fcil utilizar la ! P.Multisistema variable a crear as the second and all subsequent plots use the NoErase keyword). But it is much easier varias graficas a mostrar. ! P.Multi se define como cinco vectores de elemento como son los siguiente:

to use the !RMulti system variable to create multiple plots on the display. !RMulti is defined as a five element vector as follows:

!P.Multi[O]

El primero elemento de ! P.Multi contiene el nmero de parcelas grficos The first element of !PMulti contains the number of graphics restante para mostrar o paginas PostScript. es un no intuitivo, plots remniizing to plot on the Esto display orpoco Postscript page. pero ustedThis pede is ver cmo lo esta utilizado en un momento. a little non-intuitive, but you will see how it is used in Es normal a establecerlo a is 0, normally significando que allmeaning no hay ms parcelas moment. It set to 0, that as there are no grficas restante a ser mostradas en la salida, siguiente comando more graphics plots remaining toel be output on the display, the next graphicecommand will erase the display and start with grfico borra la pantalla inicia con la primera parcela grfica mltiple.

the first of the multiple graphics plots. This element la specifies thegrficos number of graphics Este elemento especifica nmero de columnas en elcolumns pgina. the page.
Este elemento nmero the de grficos filas en la pgina. Thisespecifica element la specifies number of graphics rows

on

on the

page.
Este elemento especifica la nmero de parcelas grficos apilados en stacked la This element specifies the number of graphics plots a established direccin Z . (Esta aplica slo si usted tiene establecido unhave sistema de in the Z direction. (This applies only if you coordenadas 3D.)

3D coordinate system.)

Sil?zple Graphical Displays


Este elemento especifica las parcelas grficss van a ser desplegadas This element si specifies whether the graphics plots are going por fila y rellenadas primero (! P.Multi [ 4] = 0) o primero llenando la or by be displayed by filling up the rows first (!P.Mzrlti[4]=0) columnas (! P.Multi [4] = 1). filling up the columns first (!PMulti[4]=1).

!P.Multi[cl]

Por ejemplo, suponeryou que want ustedto quiere establecer ! P.Multi a mostrar cuatro parcelas example, For suppose set !Z?M~llti to un display four graphics plots on the grficos en lain pantalla en dos columnas y dos filas, y usted hara que la parcelas grficos a primero display two columns and two rows, and you would like the graphics plots tollenar fill up sean las columnas . Usted puede tipear esto: columns the first. You would type: Ahora como usted mostra cuatro parcelas grficos, cada grfico se ajusta en cuarto de ventana Now as you display each of the four graphics plots, each graphic fits into about a de visualizacin. Tipee:

quarter of the display window. Type:


IDL> IDL> IDL> IDL> IDL>

Window, XSize=500, YSize=500 P l o t , t i m e , c u r v e , LineStyle=O Contour, peak, l o n , l a t , X S t y l e = l , Y S t y l e = l , NLevels=lO S u r f a c e , peak, l o n , l a t Shade-Surf, peak, l o n , l a t

Su salida debera ser similar look a la salida en to Figura 27. Your output should similar the output

in Figure 27.

Figura 27: Usted puede mltiples parcelasplots en una solo ventana de visualizacin. 27: Figzcre You caizgraficar plot multiple graphics iiz display wiitdow. a siitgle

Dejando Espacio para Ttulos con Mltiple Parcelas Grficos


Leaving Room for Titles with Multiple Graphics Plots
Cundo IDL calcula la posicin de las parcelas grficas, utiliza toda ventana para determinar cuan When IDL calculates the position of the graphics plots, it uses the entire window to grande debera ser cada parcela. Pero a veces usted le gustaria tener espacio para mostrar determine how big each plot should be. But sometimes you would extra like to have extra

Positiortiitg Graphic Outpzct in the Display Window

ttulos y otro tipos de anotacin. Usted puede dejar espacio para el uso de "margen externos " variables. The outside margins only apply when the !l?Mzrlti system variable is being campos del sistema de variables !X, !Y, y !Z . Los mrgenes externos slo se aplican cuando used. They are calculated in character units, just as the normal graphic mara' ulns are la variable del sistema ! P.Multi . Ellos son calculados enunidades de carcteres, slo con los calculated. mrgenes de grfico normales calculados. For supongo example, suppose you wanted to have an para overall for the four-graphic Por ejemplo, que usted desea tener un ttulo total las title cuatro grficas creadas. plot display you just created. You Usted puede dejar espacio para el ttulo y might crearloleave comoroom esto: for the title and create it like this:

room on the by display and margin" other types of annotation. You can room with multiple plots usingfor thetitles "outside fields of the !X, !t: and !Z leave system

IDL> IDL> IDL> IDL> IDL> IDL> IDL>

!P.Multi = 10, 2, 2, 0, l] ! Y.OMargin = [2, 41 Plot, time, curve, LineStyle=O Contour, peak, lon, lat, XStyle=l, YStyle=l, NLevels=lO Surface, peak, lon, lat Shade-Surf , peak, lon, lat XYOutS, 0.5, 0.9, /Normal, 'Four Graphics Plots1, $ Alignment=0.5, Charsize=2.5

Su salida debera ser como la ilustracin enthe Figura 28. Your output should look like illustration in

Figure 28.

Four Graphics Plots

Figura 28: UnA cuadro cuatro grficos mltiples con left espacio izquierda en la parcela superior Figure four de by four multiplot with space at the top of the plot for a title by 28: using the keyword. para un ttulo mediante el!Y.OMargiiz uso de la palabra clave ! Y.OMargin.

Siirzple Grapltical Displays

Argumentos No Simtricos con !P.Multi Non-Symmetrical Arrangements with !P.Multi


El graficado con !P.Multi hace simtrico la have grafica. ejemplo, supongamos que usted desea Plotting withno does not to Por be symmetrical on the display. For example, !l?Multi la superficie y la superficie sombreado en la parcela izquierda al lado de la de visualizacin. suppose you wanted the surface and shaded surface plot inventana the left-hand side of the Y usted desea que window el lado derecho de la the pgina seaAnd llenado con un contorno grfico de side los mismo display one above other, you wanted the right-hand of the page datos. Usted tipear este cdigo: plot of the same data. You can type this code: to puede be filled with a contour

IDL> IDL> IDL> IDL> IDL> IDL>

!P.Multi = [O, 2, 2, 0, 1 1 !Y.OMargin= [0,O] Surface, peak, lon, lat Shade-Surf , peak, lon, lat !P.Multi = [l, 2, 1, 0, 0 1 Contour, peak, lon, lat, XStyle=l, YStyle=l, NLevels=lO

The first !F!Multi command sets up a two-column by two-row configuration and the
El primer comando P.Multi dos columnas de dos hileras con figuracin y estas dos first two! of thesecon plots are drawn. por The second command sets up aprimeras two!l?Multi parcelas son dibujadas. El segundo comando ! P.Multi con Dos columna y una is filaset de to configuracin. !l?Mulfi[O] column by one-row confiouration. But notice that l. This results P Pero notarin que ! P.Multi [0]plot se establece a 1. Este resultado en la grfica de contorno puede ir the en la the contour going Into the position in the window instead of first. second segunda posicin en la ventana de29, la primera. The result is shown en in lugar Figure below. El resultado se muestra en Figura 29, a continuacin.

Figura 29: Usted puede ! P.Multi to para posicinar arreglos asimtricos de parcelas en la Figzcre You can utilizar use !P.Multi position asymmetric arraitgements of plots irt 29: ventanade visualizacin. the display window. Nota que el comando TV no funciona con ! P.Multi los comandos Plot o Contour. Sin embargo, Note that the TV command does not work with !Z?Multi like the Plot or Contour comel mands programa renplaza al comando TV y esta entre los programas que hacomdo.TVImage, However, the TVInzage program, which is a replacement forusted the TV descargado para utilizar con este libro, hace satisfacer la variable del sistema ! P.Multi .

Addiizg Text to G1*apltical Displays

Intentar estos comandos:

mand and is among the programs you downloaded to use with this book, does honor the !P.Mzrlti system variable. Try these commands:

IDL> image = LoadData ( 7 ) IDL> !P.Multi=[O, 2 , 21 U)L> FOR j = 0 , 3 DO TVImage , image Estar seguro de reajustar ! P.Multi para mostrar un sola parcela grfica en la pgina. Como muchos Be sure you reset !l?Mzrlti to display a single graphics plot on the page. Like many sistemas las variables, ! P.Multi pueden ser reajustadas por valores por defecto igual a cero, system variables, !P.Mzrlti can be reset to its default values by setting it equal to zero, al igual que esto:

like this:

Agregando para Mostrar Grficos Adding Graphical Displays Text toTexto


La parcela de anotaciones y otro textos pueden ser adicionadas a la pantalla grfica en un variedad . Plot annotations and other text can be added to graphical displays in a variety of ways, de maneras, la ms comn de las palabras clave es el comando grfico mostrar. El texto que es

the most common of which is via keywords to graphical display commands. The text

adicional puede venir en cualquier de tres fuentefont "flavors" o estilos, a ustedif leyou recomendamos: that is added can come in any of three "flavors" or styles, like: vectol.el forzts vector (sometimes fuente (a veces llamado software o fuentes fonts), Hershey), fuentesfonts, true-type, y hnrdtvnre fuentes hardware. called software or Hershey true-type and fonts. Los tipos detype letra,of tipo de is fuente es seleccionado por !Z?Fo~zt el ajuste system las variables del sistema !P.Font o por The font selected by setting the variable or by setting the la palabra clave Font en un grfico de salida conforme a Tabla 6, a continuacin. 6, below. Font keyword on a comando graphical output command according to Table

!P.Font

Seleccin de Fuente Vector Fuente (tambin las fuentes llamadas software o Hershey) Fuente Hardware Las fuentes de contorno de tipo verdadero

Tabla 6: La Fuente " puede ser seleccionado ajustando las variable delFoitt sistema ! P.Font Tlzefont "Jlavor" cart be selected by setting the !R system variable 6: '' flavor Table o la palabra clave Font para valores apropiados. El vector fuente son Tipos de fuentes por or the Foizt keyword to the appropriate value. Vectorfonts are the defecto para comandos grficos directos. Ellos tienen la ventaja de ser plataforma independientes. default font type for direct graphics commaitds. They have the Las fuentes por defecto en rutinas grficas directas son establecen el estilo del vector fuente o software . El vector Fuentes es descrito por vector de coordena. Como consecuencia, de la By default fonts in direct graphics routines are set to the vector or software font style. plataforma independiente y puede ser fcilmente girada en el espacio 3D. Sin embargo, muchas Vector fonts are described by vector coordinates. As a result, they are platform personas encuentran fuentes vectoriales "Delgadas" para calidad la salida impresa y preferir independent and can be rotated in 3D space easily. However, many people find vector fuentes sustancial para este propsito (Es decir, fuentes de tipo verdadero o fuentes hardware fonts too "thin" for quality hardcopy output and prefer more substantial fonts for this para impresin PostScript). El vector fuentes puede ser seleccionado permanentemente por la purpose (i.e., true-type fonts or Postscript hardware printer fonts). Vector fonts can be variable del sistema ! P.Font a -1 o por ajustando la palabra clave Font en un grfico salida, selected permanently by setting the !P.Forzt system variable to -1 or by setting the como esto:

advaittage of being platform irtdeperzde~tt.

Forzt keyword on a graphical output command, like this:

IDL> Plot, time, curve, Font=-l, XTitle=lTime', $ YTitle='Signall, Title=IExperiment 35F3a1

fonts are also called outline fonts. The is es described by a establecer set of outlines El tipo deTrue-type fuentes son tambin llamado fuentes perfiladoras . La font fuente descrito para that de arellenado then filled creating a un setpolgono. of polygons. IDLcon comes with four true-type un esquemas para by la creacin de IDL viene cuatro familias de fuentes font Times, Helvetica, Courier, and Symbol, but you can supplement these with true-type:families: Times, Helvetica, Courier, y Symbol, pero usted puede complementar estos con cualquier any true-type family youdisponible. have available. True-type fonts take longer to otra familia deother fuente true-type font que usted tenga Las Fuentes True-type deben ser escalas render because the font must be personas scaled and the polygons created and filled, and y los polgonos creados y llenados, muchas encontran en ellos un bit no atractivos paramany people find a en bit la unattractive at small point sizes on normal pequeos tamaos de them puntos pantalla normal de baja resolucin. Pero ellos low-resolution tienen la ventaja displays. But they have thedel great advantage of being rotatable and nice looking on de ser giratorios y bonitos en la salida dispositivos de impresin. Las fuentes True-type son por hardcopy devices. True-type fonts are the default font for the object graphics defecto fuentes paraoutput objeto en el sistema de grficos IDL. system in IDL.
Para hacer un parcela con fuente true-type Helvetica por defecto, establecer la palabra clave Font a 1, To render a plot with the default me-type Helvetica font face, set the Font keyword to como esto:

1, like this:

Siinple Graplzical Displays

IDL> Plot, time, curve, Font=l, XTitle='Timel,$ YTitle='Signall,Title='Experiment 35F3a1 El tipo de fuente verdaderas puede ser seleccionado el comando Device usando la True-type fonts can be selected with the con Device command using the Set-Font and palabras clave Set_Font y TT_Font , como esto: 'IT_Forzr keywords, like this:

/TT , Font IDL> Device, S e t - F ~ n t = ~ C o u r i e r ~ , $ Time = IDL> Plot, time, curve, Font=l, ~ ~ i t i e YTitle='Signal', Title='Experirnent 35F3a1
Para saver ms acerca Fuentes tipo verdadero utilice use el sistema de ayuda en system IDL, como esto: To learn more de about true-type fonts in IDL, your on-line help like this:

IDL> ? fonts
Las Fuentes Hardware son seleccionados por la variables del sistem ! P.Font o or la Palabra clave Hardware fonts are selected by setting the !P.Font system variable the Forzt Font a 0. Normalmente las Fuentes hardware no son utilizadas en la ventana, pero son utilizado keyword to 0. Normally hardware fonts are not used on the display, but are used when cuandooutput la salida enviado a un dispositivo de salida impresa como un impresin ises sent to a hardcopy output device such as tal a Postscript printer. PostScript. Unfortunately, Por desgracia, las fuentes de hardware no giran bien el espacio 3D y entonces eran no used utilizados hardware fonts do not rotate well in 3D space and so were not normally with 3D normalmente con los Comandos 3D como el comando Surface. commands like the Surface command.

IDL> Plot, time, curve, Font=O, XTitle='Timel , $ YTitle='Signall,Title='Experirnent 35F3a1

Finding the Names of Available Fonts Descubriendo el Nombre del Disponible Fuente
Usted puede encontrar los names nombres las Fuentes hardware usando el comando You can find the ofdisponible availablede hardware fonts by using the Device command

like this: Device como esto:


IDL> Device, Font='*', Get-FontNames=fontnames IDL> For j=0,N-Elements (fontnames) -l DO print, fontnames [j1
Fuentes del tipo verdadero son similares, excepto la Palabra clave TT_Font que es utilizado para keyword is used to select just the available true-type fonts on your system. (You can seleccionar slo la Fuentes disponible true-type en su sistema. (Usted puede agregar su propia add your own true-type fonts to the four families supplied with IDL. See the IDL onFuentes true-type a la cuatro familias suministrada con IDL. Ver la ayuda online de IDL) cmo:

The names of true-type fonts are found in a similar way, except that the TT'Folzr line help to find out how.)

IDL> ~ e v i c e ,Font=I*l, Get-FontNames=fontnames, / T T - F O ~ ~ IDL> For j= O ,N-Elements (fontnames) -l DO print, f ontnames [j]

The names of available vector fonts are given in en Table on page 53.53. 77 Los nombres disponible de las fuentes vectoriales son dados Tabla en pgina

Agregando Texto conthe el XYOutS Comando XYOutS Adding Text with Command
Una muy importante comando es XYOutS lugaratXY, la Cadena OUTput "). Esto OUTput a String"). Iten is IDL used to place a("En textun string a specific location on display. es usado para dar lugar a una cadena de texto para un lugar especfico en la ventana. (La primera (The first positional parameter to XYOutS is the X location and the secondthe positional posicion del parmetro XYOutS es la ubicacin X y la segunda posicion del parmetro es la parameter is the Y location). For example, to add a larger title to a line plot, you can ubicacin Y ).Por ejemplo, para aadir un ttulo largo para una lnea grfica, usted puede escribir type commands like this: los comandos como esto: IDL> Plot, time, curve, Position=[0.15, 0.15, 0.95, 0.851

A very important command in IDL is the XYOutS command ("at an XY location,

IDL> XYOutS, 0.5, 3 2 ,

'Results: Experiment 3 5 F 3 a 1 , Size=2.0

Notice that you specified the X and Y location with data coordinates. Also notice that theusted Y coordinate is outside the boundary ofde the plot. By default, XYOutS procedure Notar que a especificado la ubicacin con datos coordenadas X e Y. the Tambin notar que uses the data coordinate system, but the device and rzorr~zalized coordinate systems la coordenada Y es fuera del lmite de la grfica. Por defecto,el procedimiento de XYOutS utiliza can also be used the appropriate keywords are specified. los datos coordenados delif sistema, y las coordenadas normalizadas sistemas tambin pueden ser
utilizados si son especificado con la palabras clave. described by (The data coordinate system is, naturally,

the data itself. Device coordinates are sometimes called pixel coordinates and the device coordinate system (Los datos del sistema de coordenadas es decir, naturalmente, descrito por la datos en s. La is often used with images. A normalized coordinate system goes from 0 to 1 in each Coordenada son a veces llamadas coordenadas de pixeles y el sistema de coordenadas es a direction. Normalized coordinates are often used when you want device-independent menudo utilizado con imgenes. La normalizacin del sistema de coordenadas va de 0 a 1 en cada graphics output.)
direccin. La Normalizacin de coordenadas son a menudo utilizado cuando usted quierer grficar imagenes independientes en el dispositivo de salida.)

Adding Text to Graphical Displays


Por ejemplo, usted puede poner elthe ttulo en on la lnea grfica usando normalizadas,like de For example, you can put title the line plot using coordenadas rzounnlized coordinates, esta manera. Cundo usted escriba programas enit IDL una buena idea es especificar como this. When you are writing IDL programs is often a good idea to specifycosas things like ttulos y otro anotacin con coordenadas normalizada. Esto lo hace This fcil amakes lugar de slo titles and other annotation with normalized coordinates. it grficos easy to no place en la graphics ventana de visualizacin, en PostScript otros de salida de impresin como esto. not only in thepero display window, y but in archivos Postscript and other hardcopy output

files as well.
IDL> Plot, time, curve, Position= [0.15, 0.15, 0.95, 0.851 IDL> XYOutS, 0.2, 0.92, 'Results: Experiment 3 5 F 3 a 1 , $ Size=2.0, /Normal

Nmero

Descripcin

Nmero

Descripcin

!7

Complex Greek Complex Italian Math Font Special Characters Gothic English

!l6
!17 !18

Cylillic Triplex Roman Ti-iplex Italian Miscellaneous Revert to entry font

!8
!9 !10

!20

!l1

!X

Tabla 7: La fuente Hershey con correspondiente nmeros index ndice para ser utilizado The Hershey fonts with correspo~tdirzg rzuntber used todentro selectIDL. Table 7 : them within ZDL.

with Vector Using XYOutScon Vector Fonts Usando XYOutS Fuentes


TheXYOutS XYOcltS command can be used with either vector, true-type, orSimplemente hardware fonts. El comando puede ser utilizado con vector true-type, o fuentes hardware. Simply set the appropriate keyword as anteriormente. described above. The discussion Font estableciendo la adecuada palabra clave font con valorvalue descrito La discusin con concerns with vector fonts, since that is the system that is most often el vectorhere fuente, es deciritself la fuente del sistema que es ms utilizado afont menudo en comandos grficos. used in direct vector graphics commands. the available fonts with the A list ofndice La lista de la disponible Fuentes con los nmeros se utiliza vector esta dado en along Tabla 7. index numbers you use to specify the specific font is given in Table 7.
La mayor ventaja del vector fuente Hershey, es que ellos son plataforma independiente y pueden The major advantage of vector or Hershey fonts, is that they are platform independent ser escaladas y girardas en El espacio 3D. Por ejemplo, usted puede escribir la parcela de ttulo and can be scaled and rotated in 3 0 space. For example, you can write the plot title anterior en Triple Romano escribiendo:

above in Triplex Roman characters by typing:

IDL> Plot, time, curve, Position=[0.15, 0.15, 0.95, 0.851 IDL> XYOutS, 0.2, 0.92, '!17Results: Experiment 35F3a!X1, $ E Triplex Roman era especificado con la secuencia de escape !17. La !X al final de la cadena de ttulo Size=2.0, /Normal causaque la fuente a revertir detras de la fuente Simplex Romano que fue antes cambiado a Triplex The Triplex Roman characters were specified with the !l escape sequence. The ! X at Roman. Esta reversin es un paso importante porque de otra manera la7 fuente por defecto sigue the end of the title string caused the font to revert back to the Simplex Roman font establecida a Triple Romano y todo sera establecido posteriormente a Triplex romana. Por ejemplo,that was inCarcter effect before you changed it to Roman. reversion step is important intentar uso un griego como la parcela deTriplex titulo Xe intentar escrivir la parcela ttulo como esto: strings will be set with Triplex Roman characters. For This example, try using a Greek

because otherwise the default fontand gets set to Triplex Roman all subsequent character the X title try of the plot writing the plot titleand like this:

/Normal as Usted puede ver el resultado en Figura 30. Notar que ahora, incluso aunque usted no lo hizo didn't specify IDL> Plot, time, curve, XTitle=' ! 7 w 1 , $ especificado que lo debera ser as, el ttulo es escrito en Griego. Slo manera a hacer lo 0.95, 0.851 that it should be Position=[0.15, so, the title is written 0.15, in Greek characters. The only way to make it IDL> XYOutS, 0.2, 0.92, 'Experiment 35F3X1, Size=2.0,

You can see the results in Figure 30. Notice that now, even though you

Sii~zple Graphical Displays


volver a la simplex roman es default escribir otra cadena con Caracteres romanos explcitos Simplex. revert back to the Simplex Roman is write another string with explicit Simplex Por ejemplo: Roman characters. For example:

IDL> XYOutS, 0.5, 0.5,

!3Junk1,/Normal, Charsize=-l

Observe Notice el uso de la use palabra clave CharSize en el cdigo anterior. Cuando When esta palabra clave tiene un the of the ClznrSize keyword in the code above. this keyword has a valor de -1, la cadena de texto se suprime y no se escribe en la pantalla. value of - 1, the text string is suppressed and not written to the display.

Figura 30: SerBe cuidadoso usted Selecciona la fuente Hershey, usted end fuerze final con Figure carefulcuando when yozc select a Hershey font, oryouo might with plot 30: zcgal trama de ttulotitles Griego para sus like usos. that look Greek to yozcr users.

Alineando Texto Aligning Text


Usted puede posicinar texto con respeto a la ubicacin llamando a XYOutS conto laXYOutS palabra with clave You can position text with respect to the location specified in the call Alignment the a un valor de 0 justificando la cadena a la izquierda (Este es la caso por defecto); Aligrzrnei~t keyword. A value of 0 will left justify the string (this is the default un valor de 1 justifica la cadena la derecha; un valor de 0.5 centro la cadena con center respeto a la will right justify the string; and a value of 0.5 will the string case); a value of l a ubicacin especificado loslocation valore X e Y. Porby ejemplo: with respect por to the specified the X and Y values. For example:
IDL> Window, XSize=300, YSize=250 IDL> XYOutS, 150, 55, 'Research1,Alignment=O.O, $ /Device, CharSize=2.0 IDL> XYOutS, 150, 110, 'Research', Alignment=0.5, $ /Device, CharSize=2.0 IDL> XYOutS, 150, 170, 'Research1,Alignment=l.O, $ /Device, CharSize=2.0 IDL> Plots, [0.5, 0.51, [1.0, 0.01, / ~ o r m a l

Borrando Texto
El Texto Text escrito con XYOutS puede a veces ser "Borrado" por el mismo color de fondo. La palabra Erasing clave Color en conjuncin con el sistema de variable !P.Background es utilizado para este propsito. Textslo that funciona is written with XYOutS si can be "erased" by writing the same textpara Nota que este perfectamente la sometimes texto era escrito en el fondo,otro mtodo mejor over in the background Color keyword in conjunction with the color. The better methods to erase annotations. (See "Erasing Annotation From theejemplo Display" on borrar anotaciones. (Ver "Borrado Anotacin De lMuestra " en la pgina 114), por cmo !P.Bnckgrouizd system variable is used for this purpose.with Note that this only works example.) Tofondo, see how to erase annotation the background color, 114, for borrar unapage anotacin con el color de tipee esto:

perfectly type this: if the text was written on nothing but the background! There are often other,
IDL> Window, XSize=300, YSize=250 IDL> XYOutS, 150, 110, 'Researchv,Alignment=0.50, $ /Device, CharSize=2.0 IDL> XYOutS, 150, 110, 'Research1,Alignment=0.50, $ /Device, CharSize=2.0, Color=!P.Background

Adding Text to Grapltical Displays

Orientando Texto Orientingel Text


EL texto especificado con el comando puede ser orientado respeto a larespect horizontal The text specified with theXYOutS command can be con oriented with to the XYOutS con la palabre clave Orientation, que especifica la nmero de grados queel texto base girar the horizontal with the Orieiztation keyword, which specifies the number va of ha degrees lejos de la lnea horizontal de base. Por ejemplo, tipee: text baseline is rotated away from the horizontal baseline. For example, type:

IDL> Window, XSize=300, YSize=250 IDL> XYOutS, 150, 110, 'Research', Alignment=0.50, $ /~evice, CharSize=2.0, Orientation=45 IDL> XYOutS, 150, 180, 'Research1,Alignment=0.50, $ / ~ e v i c e ,CharSize=2.0, Orientation=-45

Positioning Textdel Texto Posicionamiento


IDL tambin proporciona un nmero de formas de posicin y manipulacin de texto en pantallas displays. For example, it is possible to create subscripts and superscripts in a plot title. grficas. Por ejemplo, es posible crear subndices y superndices en un parcela de ttulo. EL Text positioning is accomplished by means of embedded positioning commands, as posicionamiento del texto es logrado por medio de comandos de posicionamiento, como se muestra shown in Table 8, below. en Tabla 8, a continuacin.

IDL also provides a number of ways to position and manipulate text in graphical

Comandos

Accin del comando

Cambie texto sobre la lnea de divisin. Cambie texto debajo de la lnea de divisin. Inserte un variable deretorno y comience una nueva lnea del texto. Cree un subndice de primer nivel. Cree un ndice sobrescrito de primer nivel. Cree un subndice de tipo de ndice Cree un subndice de segundo nivel. Cambio de vuelta al nivel normal despus de cambiar nivel. Restare la posicin de texto a ltima posicin salvada. Salve la posicin actual de texto. Cree un ndice sobrescrito de tipo de ndice. Retorna a la fuente de entrada.(use despus que la fuente cambie) Muestre unos o ms caracteres por su valor de unicode. Muestre el signo de admiracin ! Tabla 8: Los comandos que pueden lograr el posicionamiento del texto. Estos son a strings. These are often used to produce subscripts and superscripts L z menudo utilizado producir subndices y superndices en la parcela de ttulos, plotpara titles, for example. por ejemplo.

Table 8:

The embedded commands that cart accomplish textpositioitiizg in

For ejemplo, example, equation canser be escrito written like esto: this: Por unan ecuacin puede como Alignment=0.5, Size=3.0, $ IDL> XYOutS, 0.5, 0.5, / ~ o r m a l , 'Y = 3X!U2!N + 5x + 3'

Sintple Graphical Displays

Agregando y Smbolos al Grfico to Graphical Adding Lines Lneas and Symbols Displays
Otro rutina til para anotaciones grficas en pantallas es el comando PlotS, que es utilizado para Another useful routine for annotating graphical displays is the PlotS command, which dibujar smbolos o lneas en la grfica. El comando Plots trabaja en cualquiera de los espacios is used to draw symbols or lines on the graphic display. The PlotS command works in bi o tridimensional.

either two- or three-dimensional space.

Para dibujar lneawith con la con el comando PlotS procure, simplemente proporcionar To drawun a line the X vector PlotS procedure, simply provide it with a vector of un and Yde Valores X ethat Y que describen elpoint par de puntos XY. Por ejemplo, dibujar una lnea de base la lnea XY values describe pairs that should be connected. For example, toen draw a grfica para el punto (0, 15) al punto tipee: (0, 15) to the point (6, 15), type: baseline on the line plot from (6, the15), point

IDL> IDL> IDL> IDL> IDL>

Window, XSize=500, YSize=400 Plot, time, curve xvalues = [O, 61 yvalues = [15, 151 PlotS, xvalues, yvalues, ~ i n e ~ t y l e = 2

Your debera output should look similar to the output Figure 3 1, below. Su salida ser similar a la salida en Figura 31, ain continuacin.

Figura 31: La grfica es anotado con un discontinua lnea estirado a travs de su centro con Figure 31: Tlzisplot is annotated witlz a dashed line drawiz across its center witlz the el comando PlotS. PlotS commaitd.

El procedimiento del comando PlotS puede tambin ser utilizado para marcar smbolos en vario The PlotS procedure can also used to marker symbols at various locations. ubicaciones. Por ejemplo, aqu es un be manera deplace etiquetar cada quinto punto en la curva con un For example, here is a way to label every fifth point in the curve with a diamond rombo.

symbol.

TvLCT, [70, 255, 01, [70, 255, 2501, [70, 0, 01, 1 Plot, time, curve, Background=l, Color=2 index = IndGen ( 20) * 5 Plots,time [index], curve [index], PSym=4,$ Color=3, SymSize=2 El comando PlotS puede tambin serbe utilizado para dibujar caja important de importante informacin The PlotS command can also used to draw a box un around information in a alrededor en By una parcela. Combinando el comando otro comandos de grficos, plot. combining the PlotS command withPlotS othercon graphics commands, such as tal como XYOutS, usted puede eficazmente anotar su graphic pantallas grfico.For Porexample, ejemplo, like algothis: como esto: you can effectively annotate your displays. XYOutS,
IDL> IDL> IDL> IDL> IDL> IDL> IDL> IDL> IDL> IDL> IDL>

TvLCT, [70, 255, 01, [70, 255, 2551, [70, 0, 01, 1 Device, Decomposed=O Plot, time, curve, Background=l, Color=2 box-X-coords = [O.4, 0.4, 0.6, 0.6, 0.4l box-y-coords = [0.4, 0.6, 0.6, 0.4, 0.41 Plots, box-X-coords, box-y-coords, Color=3, /Normal XYOutS, 0.5, 0.3, 'Critical Zone1,Color=3, Size=2, $ Alignment = 0.5, /Normal

Adding Color to Your Gi.aphical Displays

You can easily use the XYOzitS and PlotSXYOutS commands to para create legends for para yoursu graphUsted puede fcilmente utilizar los comandos y PlotS crear leyendas ics displays. pantallas grficas.

Agregando su Pantalla Grfico Displays Adding Color Color to YouraGraphical


Otra til manera para anotar su pantallas grficas es a utilizar el comando Color. El Comando Another useful way to annotate your gsaphical displays is to use color. The Polyfill Polyfill es de bajo nivel grfico para mostrar, el comando fill llena arbitrariamente cualquier shaped command is a low-level graphic display command that will fill any arbitrarily forma de polgono (Que puede ser especificado en dos o tres dimensiones) con un color en polygon (which can be specified in either two or three dimensions) with a particular particular o patrn. Por ejemplo, usted use Polyfill para llenar la caja en la parcela de lnea above color or pattern. For example, you can use Polyfill to fill the box in the line plot anteriormente con un color rojo:

with a red color:


LDL> IDL> IDL> IDL> IDL> IDL>

TvLCT, 255, 0, 0, 4 Erase, Color=l Polyfill, box-X-coords, box-y-coords, C010r=4, /Normal Plot, time, curve, Background=l, Color=2, / N o ~ r a s e PlotS, box-X-coords, box-y-coords, Color=3, /Normal XYOutS, 0.5, 0.3, 'Critical Zone', Color=3, Size=2, $ Alignment = 0.5, /Normal

Color can sometimes serve to represent another dimensional property of para a data set. For A veces el comando Color puede servir para representar otra propiedad dimensional los example, you display datalos as datos a 2D XY plot of circles (polygons), with the color datos establecido. Pormight ejemplo, ustedXY muestre como una grfica en 2D de crculos of each polygon some additional property of the data such as temperature (Polgonos), con el color representing de cada polgono que representa propiedades adicionales de los datos or temperatura population density, etc.densidad,etctera. Let's see how this can be done. tal como o poblacin, Vamos a ver cmo esto puede ser hecho.
IDL no tiener incorporado un generador de crculos, pero es fcil y suficiente escribir una funcin. function. Open a text editor and type the code below to create the IDL function named Abiendo un editor texto y tipear el cdigo a continuacin para crear en IDL la funcin llamado Circle.

IDL doesn't have a built-in circle-generator, but it is easy enough to write such a Circle.

FUNCTION CIRCLE, xcent er, ycenter, radius points = (2 * !PI / 99.0) * FIndGen(100) X = xcenter + radius * Cos (points) y = ycenter + radius * Sin(points) RETURN, Transpose ( [ [X], [y]1 ) END

The X and Y points that comprise the circle be returned inmatriz a 2 by array. Los puntos Xe Y que comprender el crculo pueden ser will retornados en una de100 2 por 100 You can use this as input to the Polyfill command. Save the program as circle.pl-o mzd elementos. Usted puede utilizar esto como entrada para el comando Polyfill. Guardar el programa by typingescribiendo this command: coinpile it como circle.pro y compilarlo este comando:
IDL> .Compile circle A continuacin, crear aleatoriamente datos de posicin X e Y. (Usted puede establecer la semilla create de some randomly-located and Y data. will set en the seed 32, to begin, (seed)Next, a comenzar, modo que su resultadosX buscados como(You la ilustracin Figura a that your results will look like the illustration in Figure below.) Type: 32, continuacin.) Tipee esto: IDL> seed = -3L IDL> X = RandomU(seed, 30) IDL> y = RandomU(seed, 30)
Los valores Z se conbe una funcin con Y. como esto: Let the values a function of estos thesevalores Yy values. Type: Z crea X and X

so

AbiendoOpen un ventana gradica y localizarla en XY, as usted ver see cmo la datos estan a window and plot the XY locations, sopuede you can how the data is distributed

in a al random pattern. Type: distribuidos azar. Tipee esto:


IDL> Window, XSize=400, YSize=350 IDL> Plot, X, y, Psym=4, Position=[0.15, 0.15, 0.75, 0.951, $ XTitle='X ~ o c a t i o n s ' ,YTitle='Y Locations'

XY point are los going to asociados display the Z variable data associated with each pair as a circle of a PuedesYou mostrar datos a la Z para cada par de puntos XY con crculos
different color. Tohacer do this, you will need to load a color table and scale the Z data into de colores diferentes. Para esto, usted necesitar cargar una tabla de colores y escalar
los datos Z al alcance de colores usted pueda disponer. Tipee esto:

the range of colors you have available to you. Type:

Siitlple Graplzical Displays

IDL> LoadCT, 2 IDL> zcolors = BytScl(z, Top=!D.Table-Size-l)


El programa Circle usted esta usando en este ejemplo tiene debilidades. Su principal deficiencia major deficiency is that it doesn't always produce circles! If you specify the es que no siempre produce crculos. Si usted especificalos datos de las coordenadas de los coordinates of the circle in the data coordinate system, the circle may show up on the crculos del sistema, pueden mostrar en la pantalla como un elipse, dependiendo del aspecto de display as an ellipse, depending upon the aspect ratio of the plot and other factors. (To la proporcin grfica y otro factores. (Para obtener un excelente crculo, descargar la programa obtain an excellent circle program, download the program TVCii-clefrom the NASA TVCircle de la NASA Goddard Astrofsica IDL Library. Usted puede encontrar la biblioteca con un Goddard Astrophysics IDL Library. You can find the library with a web browser at navegador web en World Wide Web en la Direccin:http:/lidlastro.gsfc.nasa.gov/homepage.html.)

The Circle progranl you are using in this example has a couple of weaknesses. Its

this World Wide Web address: http://idlastro.gsfc.i~asa.go~~fionzepage.ht~~zl.)

Para To evitar estethis deficiencia en el in programaa circle, convertir los datos a un recurso avoid deficiency the Circle program, convert the coordenados data coordinates to device de coordenadas con la con el comando Convert_CoordTipo: coordinates with the Coizvert-Coord command. Type:

IDL> coords = Convert-Coord(x, y, /Data, /To-~evice) IDL> X = coords(O,*) IDL> y = coords(l,*)

Now, you are finally use the Polyfll command drawcrculos the colored circles Ahora, usted finalmente esta ready listo a to utilizar lel comando Polyfill parato dibujar de colores que representan los valores los Z datos Z. Tipee: that represent thede data values. Type:
IDL> For j=O, 29 DO Polyfill, Circle(x(j), y(j), 10), $ /Fill, Color=zcolors(j), / ~ e v i c e

As an added touch, it would be nice to have a color that can tell you something Como toque adicional, deberia tener una barra de colores que bar puede decidir los valores Z y su about the Z values and what the color means. You can add a color bar to the plot with nivel de color. Usted puede aadir una barra de color a la grfica con el comando Colorbar, the Colorbar program that came with this book. Type: programa que vino con este libro. Tipee:
IDL> Colorbar, position = [0.85, 0.15, 0.90, 0.951, $ 1 , /vertical, $ Range= [Min(z),Max (z) Format=I(I5)l, Title='Z Values1
Su salida similar a lasimilar ilustracin en Figura 32. Your debera output ser should look to the illustration

in Figure 32.

3186

>
N

a , 3 (d

V)

1595

0.0

0.2

0.4 0.6 0.8 X Locations

1.O

Figura 32: El color de los crculos representa una tercera dimensin en esta grfica 2D. Figure 32: The color of the circles represents a tlzird dimensiorz irt tlzis 2Dplot.

You might also like