f

#### multiple 2d_plots in one system (itools)

```Hello,

I am trying to plot multiple size distributions of an
aerosol in one plot. What I have tried so far: the plot
structure of the J�lihc group, but it is limited to
25 datasets, in my case there can be 100 datasets.

What I tried next is the new itools procedure iplot,
but it does not work as i expected it to. First, the
x axis should be logarithmic (values from 0.038 to 16 �m).
When i set xrange to [min(xdata),max(xdata)] the axis ranges from
~0 to 10e16, so I tried alog10() of the above resulting in
a LINEAR axis from -1.4 to 1.2 even though I have set /x_log.
I cannot see a way to get the axis I want.

Second I don't see any data in the plot although the visualisation
manager shows all datasets (show=true). It's just my first try using
itools, but it seems they are much less intuitive than I expected.
Here is the code I used:

xmin=min(Dp)
xmax=max(Dp)
ymax=max(50)

for i=0,max_nr  do begin

if i eq 0 then begin
iplot, Dp[*,i], dN[*,i]/duration[i], \$
/x_log,xrange=[xmin,xmax],yrange=[0,ymax]
view_nr=itgetcurrent()
endif else iplot, Dp[*,i], dN[*,i]/duration[i], \$
/x_log,xrange=[xmin,xmax],yrange=[0,ymax],overplot=view_nr
endfor

Omitting xrange, yrange and x_log does not change the result
(as can be expected).

Another question:

Is there another easy way to get these plots done? I wonder
if there is a way to get them in a 3D plot as stacked xy plots
with z as the time of measurement but NOT as surface plots
(but filled to the x-axis would be OK). Like this:

y (counts, dN)
|
|
|       z(time)
|      /                   **
|     /          ****   ***  **
|    /        ***    ***       *****
|   **********                      ******
|  /    ++
| /  +++  +++          ++
|++++        ++++++++++  ++++++++++++++++
-------------------------------------------x (size, Dp)

Hmmm, I hope you get my idea :-)
So far, I haven't seen a way to do this in IDL.

Thanks,

Olaf

``` 0 9/10/2003 1:29:17 PM comp.lang.idl-pvwave  12260 articles. 4 followers. 4 Replies 648 Views Similar Articles

[PageSpeed] 23

```Olaf Stetzer writes:

> I am trying to plot multiple size distributions of an
> aerosol in one plot. What I have tried so far: the plot
> structure of the J�lihc group, but it is limited to
> 25 datasets, in my case there can be 100 datasets.
>
> What I tried next is the new itools procedure iplot,
> but it does not work as i expected it to. First, the
> x axis should be logarithmic (values from 0.038 to 16 �m).
> When i set xrange to [min(xdata),max(xdata)] the axis ranges from
> ~0 to 10e16, so I tried alog10() of the above resulting in
> a LINEAR axis from -1.4 to 1.2 even though I have set /x_log.
> I cannot see a way to get the axis I want.

Yes, it seems like the [XY]_LOG keywords are broken.
In any case, I can't seem to get a log axis on
an iPlot by setting either of these keywords. And
worse, the logarithmic selection on the axis property
sheet is grayed out and unavailable for the axes.
I don't know what to make of that. I guess I would
check with RSI.

> Is there another easy way to get these plots done? I wonder
> if there is a way to get them in a 3D plot as stacked xy plots
> with z as the time of measurement but NOT as surface plots
> (but filled to the x-axis would be OK).
> So far, I haven't seen a way to do this in IDL.

There is no built-in command to do this, I don't think.
But it seems fairly straightforward to me to build your own.
I just threw my 2D array into FSC_SURFACE and selected
you describe. You want your plots in a different plane,
and you want log axis scaling, but having a rotatable
plot is nice. Probably a two hour job if you
page. :-)

Cheers,

David

--
David W. Fanning, Ph.D.
Fanning Software Consulting, Inc.
Phone: 970-221-0438, E-mail: david@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
``` 0 9/10/2003 2:13:05 PM
```Hi Olaf,

I think there are three different issues here.

1. For logarithmic axes, the min and max for the axis range *must* be
greater than 0, otherwise the X/Y/Z_LOG keywords have no effect and that
property is grayed out in the property sheet (I think this was Dave's
problem). So if you try to do a simple "iplot, findgen(10), /y_log", it will
ignore the y_log. However, "iplot, findgen(10)+1, /y_log" will work fine.
This isn't really a problem in your case, just a side note.

2. I think you've discovered a bug. It seems like x/y/z_log is not happy if
you do an overplot on top of a logarithmic plot. For some reason it sets the
axis range to 10^16, which is what you observed. We will fix this. As a
workaround, you can do all of your plots first, and then only set x_log on
the *last* overplot.

For example:

; Create fake data.
n = 101
max_nr = 5
; X goes from 0.038 up to 16.
Dp = FINDGEN(n)/100*16
Dp = 0.038
Dp = REBIN(Dp, n, max_nr)
Dn = RANDOMU(s, n, max_nr)
duration = REPLICATE(1, max_nr)

xmin=min(Dp)
xmax=max(Dp)
ymax=max(Dn)

IPLOT, Dp[*,0], dN[*,0]/duration, \$
XRANGE=[xmin,xmax], \$
YRANGE=[0,ymax]
for i=1,max_nr-1  do begin
; Note: OVERPLOT is either "on" or "off", not an integer.
; To work around bug, only set X_LOG on the last overplot.
iplot, Dp[*,i], dN[*,i]/duration[i], /OVERPLOT, \$
X_LOG=(i eq max_nr-1)
endfor

This seems to work fine.

3. You can do three-dimensional plots using "iplot".
For example:

; Try a three-dimensional plot. Use fake Z data.
; You could also rearrange the X/Y/Z args.
iplot, Dp[*,0], dN[*,0]/duration, FLTARR(n), \$
XRANGE=[xmin,xmax], \$
YRANGE=[0,ymax]
for i=1,max_nr-1  do begin
; Shift the next plot by some amount in Z.
IPLOT, Dp[*,i], dN[*,i]/duration[i], FLTARR(n)+i, /OVERPLOT, \$
X_LOG=(i eq max_nr-1)
endfor

I just gave it a set of Z coordinates, one for each data point. Then I shift
the Z coordinates up by some amount, which would presumably be your "time".
You may need to do some tweaking of the axis range or the scaling or
rotation, but this should get you started.

Hope this helps.

-Chris Torrence
Research Systems, Inc.

"Olaf Stetzer" <olaf.stetzer@imk.fzk.de> wrote in message
news:bjn8vd\$752\$1@news.rz.uni-karlsruhe.de...
> Hello,
>
> I am trying to plot multiple size distributions of an
> aerosol in one plot. What I have tried so far: the plot
> structure of the J�lihc group, but it is limited to
> 25 datasets, in my case there can be 100 datasets.
>
> What I tried next is the new itools procedure iplot,
> but it does not work as i expected it to. First, the
> x axis should be logarithmic (values from 0.038 to 16 �m).
> When i set xrange to [min(xdata),max(xdata)] the axis ranges from
> ~0 to 10e16, so I tried alog10() of the above resulting in
> a LINEAR axis from -1.4 to 1.2 even though I have set /x_log.
> I cannot see a way to get the axis I want.
>
> Second I don't see any data in the plot although the visualisation
> manager shows all datasets (show=true). It's just my first try using
> itools, but it seems they are much less intuitive than I expected.
> Here is the code I used:
>
> xmin=min(Dp)
> xmax=max(Dp)
> ymax=max(50)
>
> for i=0,max_nr  do begin
>
> if i eq 0 then begin
>      iplot, Dp[*,i], dN[*,i]/duration[i], \$
> /x_log,xrange=[xmin,xmax],yrange=[0,ymax]
>      view_nr=itgetcurrent()
>      endif else iplot, Dp[*,i], dN[*,i]/duration[i], \$
>          /x_log,xrange=[xmin,xmax],yrange=[0,ymax],overplot=view_nr
> endfor
>
> Omitting xrange, yrange and x_log does not change the result
> (as can be expected).
>
> Another question:
>
> Is there another easy way to get these plots done? I wonder
> if there is a way to get them in a 3D plot as stacked xy plots
> with z as the time of measurement but NOT as surface plots
> (but filled to the x-axis would be OK). Like this:
>
>
> y (counts, dN)
> |
> |
> |       z(time)
> |      /                   **
> |     /          ****   ***  **
> |    /        ***    ***       *****
> |   **********                      ******
> |  /    ++
> | /  +++  +++          ++
> |++++        ++++++++++  ++++++++++++++++
> -------------------------------------------x (size, Dp)
>
> Hmmm, I hope you get my idea :-)
> So far, I haven't seen a way to do this in IDL.
>
> Thanks,
>
> Olaf
>

``` 0 9/10/2003 7:40:17 PM
```Chris Torrence schrieb:
> Hi Olaf,
>
> I think there are three different issues here.
>
> 1. For logarithmic axes, the min and max for the axis range *must* be
> greater than 0, otherwise the X/Y/Z_LOG keywords have no effect and that
> property is grayed out in the property sheet (I think this was Dave's
> problem).

Yes, that is what the manual says. I tried to switch to the logarithms
of the min/max values (-> -1.4,1.2) because I got the impression, that
x_range is interpreted that way when X_LOG is set (max value of 10^16
instead of 16). Maybe this is just the same bug you mentioned in 2.

> 2. I think you've discovered a bug. It seems like x/y/z_log is not happy if
> you do an overplot on top of a logarithmic plot. For some reason it sets the
> axis range to 10^16, which is what you observed. We will fix this. As a
> workaround, you can do all of your plots first, and then only set x_log on
> the *last* overplot.

Thanks, I will try this.

> xmin=min(Dp)
> xmax=max(Dp)
> ymax=max(Dn)
>
> IPLOT, Dp[*,0], dN[*,0]/duration, \$
>     XRANGE=[xmin,xmax], \$
>     YRANGE=[0,ymax]
> for i=1,max_nr-1  do begin
>     ; Note: OVERPLOT is either "on" or "off", not an integer

The online help says that it has to be set to the ToolID of
the iTool I want to use. But now I see, that this only applies
if more than one iTool exists.

>     ; To work around bug, only set X_LOG on the last overplot.
>     iplot, Dp[*,i], dN[*,i]/duration[i], /OVERPLOT, \$
>         X_LOG=(i eq max_nr-1)
> endfor
>
> This seems to work fine.
>
> 3. You can do three-dimensional plots using "iplot".
> For example:
>
> ; Try a three-dimensional plot. Use fake Z data.
> ; You could also rearrange the X/Y/Z args.
> iplot, Dp[*,0], dN[*,0]/duration, FLTARR(n), \$
>     XRANGE=[xmin,xmax], \$
>     YRANGE=[0,ymax]
> for i=1,max_nr-1  do begin
>     ; Shift the next plot by some amount in Z.
>     IPLOT, Dp[*,i], dN[*,i]/duration[i], FLTARR(n)+i, /OVERPLOT, \$
>         X_LOG=(i eq max_nr-1)
> endfor
>
> I just gave it a set of Z coordinates, one for each data point. Then I shift
> the Z coordinates up by some amount, which would presumably be your "time".
> You may need to do some tweaking of the axis range or the scaling or
> rotation, but this should get you started.
>
> Hope this helps.

Yes, it looks like exactly what I want.

Thanks a lot,

Olaf

``` 0 9/11/2003 9:36:16 AM
```Olaf Stetzer wrote:

> Hello,
>
> I am trying to plot multiple size distributions of an
> aerosol in one plot. What I have tried so far: the plot
> structure of the J�lihc group, but it is limited to
> 25 datasets, in my case there can be 100 datasets.

Dear Olaf,

the limits comes from the legend entry field.
We thought it does not look good to have more as 25 lines in the legend.

You could extend this in get_plot_struct line 201
nlegend=25
to whatever you want.

If you switch of the legend by plot.new=3 this works too.

pro test
x=findgen(10) & y=sin(x)
plotprepare,plot,dim=1
plotinit,plot
for i=0,99 do begin
plot.legend_name=n2s(i)
y=y-float(i)/100.
plotxy,plot,x=x,y=y
plot.new=3
endfor
plotend,plot
end

By plot.new=2 the next plot get's no legend entry. So if you put every 4th
entry to the legend if it's size is 25 lines then it works too.

>
> What I tried next is the new itools procedure iplot,
> but it does not work as i expected it to. First, the
> x axis should be logarithmic (values from 0.038 to 16 �m).
> When i set xrange to [min(xdata),max(xdata)] the axis ranges from
> ~0 to 10e16, so I tried alog10() of the above resulting in
> a LINEAR axis from -1.4 to 1.2 even though I have set /x_log.
> I cannot see a way to get the axis I want.
>
> Second I don't see any data in the plot although the visualisation
> manager shows all datasets (show=true). It's just my first try using
> itools, but it seems they are much less intuitive than I expected.
> Here is the code I used:
>
> xmin=min(Dp)
> xmax=max(Dp)
> ymax=max(50)
>
> for i=0,max_nr  do begin
>
> if i eq 0 then begin
>      iplot, Dp[*,i], dN[*,i]/duration[i], \$
> /x_log,xrange=[xmin,xmax],yrange=[0,ymax]
>      view_nr=itgetcurrent()
>      endif else iplot, Dp[*,i], dN[*,i]/duration[i], \$
>          /x_log,xrange=[xmin,xmax],yrange=[0,ymax],overplot=view_nr
> endfor
>
> Omitting xrange, yrange and x_log does not change the result
> (as can be expected).
>
> Another question:
>
> Is there another easy way to get these plots done? I wonder
> if there is a way to get them in a 3D plot as stacked xy plots
> with z as the time of measurement but NOT as surface plots
> (but filled to the x-axis would be OK). Like this:
>
>
> y (counts, dN)
> |
> |
> |       z(time)
> |      /                   **
> |     /          ****   ***  **
> |    /        ***    ***       *****
> |   **********                      ******
> |  /    ++
> | /  +++  +++          ++
> |++++        ++++++++++  ++++++++++++++++
> -------------------------------------------x (size, Dp)
>
> Hmmm, I hope you get my idea :-)
> So far, I haven't seen a way to do this in IDL.

Itools are a very good addon to idl. I got the 6.0 licenses on monday and we
are now waiting for the CDs.

Reimar

--
Forschungszentrum Juelich
email: R.Bauer@fz-juelich.de
http://www.fz-juelich.de/icg/icg-i/
==================================================================
a IDL library at ForschungsZentrum Juelich
http://www.fz-juelich.de/icg/icg-i/idl_icglib/idl_lib_intro.html

``` 0 9/12/2003 7:05:34 AM