---在大同的世界里,创造大不同-------------------------------------------------------
查看文章 |
【转】用数字作为线画图的标记
2009-08-28 12:18
大卫的网站被和谐后,给很多IDLer带来了不便。不能及时访问到大卫老兄的最新发布。这里转来一些大卫老兄的好东西,分享给大家。不翻译了,懒。。。Using Numbers as SymbolsQUESTION: 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=SymCat(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.
An IDL plot with numbers used in place of symbols. |
最近读者:

!