Re: plot & oplot [message #40688] |
Tue, 24 August 2004 01:16 |
Paolo Grigis
Messages: 171 Registered: December 2003
|
Senior Member |
|
|
Christopher Lee wrote:
> In article <cge3ri$kq6$1@agate.berkeley.edu>, "Marshall Perrin"
> <mperrin+news@cymric.berkeley.edu> wrote:
>
>
>
>> IDLmastertobe <shi_lee@hotmail.com> wrote:
>>
>>> If I was to plot a 1-d function, and wanted to do an oplot on the same
>>> window, how would I hide sections of the oplot that goes underneath the
>>> plot. I eventually want to do multiple oplots and hide sections that
>>> fall underneath the previous oplot. Please help.
>>
>> Just plot your functions from 'back' to 'front'. Each oplot will
>> overplot (hence the name!) everything that came before.
>> - Marshall
>
>
> Unless you want 'underneath' in the vertical axis sense, not the z-axis
> sense.
>
> You can use polyfill, with the background color, to block out anything
> under the line you plot.
>
> e.g
> ;some data
> x=findgen(101)
> y1=x
> y2=100-x
>
> plot, x,y1 ;the first data
> ;cover up everything underneath the second line
> polyfill, [x, reverse(x)], [y2, replicate(min(y2),n_elements(x))],color=0
> ;plot the second line
> oplot, x,y2
> ;replot the axis
> plot, x, y1,/nodata,/noer
> ;
>
> Chris
For simple plots, one could even try
plot,x,y1
oplot,x,y2>y1
Paolo
|
|
|
Re: plot & oplot [message #40689 is a reply to message #40688] |
Tue, 24 August 2004 00:52  |
Chris Lee
Messages: 101 Registered: August 2003
|
Senior Member |
|
|
In article <cge3ri$kq6$1@agate.berkeley.edu>, "Marshall Perrin"
<mperrin+news@cymric.berkeley.edu> wrote:
> IDLmastertobe <shi_lee@hotmail.com> wrote:
>> If I was to plot a 1-d function, and wanted to do an oplot on the same
>> window, how would I hide sections of the oplot that goes underneath the
>> plot. I eventually want to do multiple oplots and hide sections that
>> fall underneath the previous oplot. Please help.
> Just plot your functions from 'back' to 'front'. Each oplot will
> overplot (hence the name!) everything that came before.
> - Marshall
Unless you want 'underneath' in the vertical axis sense, not the z-axis
sense.
You can use polyfill, with the background color, to block out anything
under the line you plot.
e.g
;some data
x=findgen(101)
y1=x
y2=100-x
plot, x,y1 ;the first data
;cover up everything underneath the second line
polyfill, [x, reverse(x)], [y2, replicate(min(y2),n_elements(x))],color=0
;plot the second line
oplot, x,y2
;replot the axis
plot, x, y1,/nodata,/noer
;
Chris
|
|
|
Re: plot & oplot [message #40691 is a reply to message #40689] |
Mon, 23 August 2004 17:58  |
mperrin+news
Messages: 81 Registered: May 2001
|
Member |
|
|
IDLmastertobe <shi_lee@hotmail.com> wrote:
> If I was to plot a 1-d function, and wanted to do an oplot on the same
> window, how would I hide sections of the oplot that goes underneath the
> plot. I eventually want to do multiple oplots and hide sections that fall
> underneath the previous oplot. Please help.
Just plot your functions from 'back' to 'front'. Each oplot will
overplot (hence the name!) everything that came before.
- Marshall
|
|
|