Fanning Software Consulting

Using Numbers as Symbols

QUESTION: I would like to display a normal IDL line plot, but instead of using a symbol to represent each point, I would like to use a number. Is this possible in IDL?

ANSWER: Yes, it is possible to do this. Here is an example of the kind of code you might have to write. First, let's create some data to plot.

   x = Indgen(50)
   y = RandomU(-3L, 50) * 100

And now we plot the data. Notice that we are going to create a space for the numbers by first overplotting a blank space where we can write the numbers.

   Plot, x, y, BACKGROUND=FSC_Color('ivory'), COLOR=FSC_Color('navy')
   OPlot, x, y, COLOR=FSC_Color('ivory'), PSYM=cgSymCat(15), SYMSIZE=2.0
   XYouts, x, y, StrTrim(Sindgen(50)+1, 2), COLOR=FSC_Color('red'), $
        ALIGN=0.5, CHARSIZE=0.75

You can see the result of the code above in the figure below.

Plot with numbers as symbols.
An IDL plot with numbers used in place of symbols.
 

Version of IDL used to prepare this article: IDL 7.0.3.

Google
 
Web Coyote's Guide to IDL Programming