On Apr 3, 11:21 am, mankoff <mank...@gmail.com> wrote:
> On Apr 2, 6:12 am, David Fanning <n...@dfanning.com> wrote:
>
>
>
>> I've made plots like this before. It is not particularly
>> difficult to do *a* plot. It is more difficult to write
>> this kind of functionality in a general way.
>
> I think I just came up with a fairly generic implementation here:http://code.google.com/p/kdm-idl/source/browse/trunk/pl otbreak.pro
>
> For example I was able to produce the following graphic (including
> equivalent of OPLOT command) with the following two lines of code.http://kenmankoff.com/tmp/plotbreak.png
>
> plotbreak, time, p, $
> position=pos, $
> xrange0=[0,1000], $
> xrange1=[1000,3000], $
> breakpct=66, $
> key0={ytitle:'Population (Phytoplankton)', $
> xtitle:'Time (days)', $
> xtickn:['0','20','40','60','80',' '],$
> title:'Predator v. Prey', $
> thick:2}, $
> key1={xtitle:'Time (days)', $
> yst:5,thick:2,$
> xtickn:['100','150','200','250','300'] }
>
> plotbreak, time, z, $
> position=pos, $
> breakpct=66, $
> xrange0=[0,1000], $
> xrange1=[1000,3000], $
> key0={NOERASE:1,color:253,thick:3,yst:5,xst:5}, $
> key1={color:253,thick:3,xst:5,$
> ytitle:'Population (Zooplankton)'}
>
> A truly generic algorithm, which would be difficult, would be
> recursive and let me specify BREAKPCT=[10,30,80,90,95] rather than
> just as a single percentage (66% in the above example). It should also
> be recursive in X and Y. That algorithm, when complete, could then
> easily be used to draw, for example, a calendar with the weekends
> (first and last column) thinner than the middle weekdays. I'll leave
> that as an exercise to the reader.
>
> -k.
Not sure if anyone has downloaded this but I found some bugs and fixed
them. I also changed key0 and key1 keywords to be _EXTRA_0 and
_EXTRA_1 to be more 'standard'.
Simpler examples of usage than originally provided, that I think
demonstrate generality, are:
x = dindgen(51)
IDL> plotbreak, x, exp(x)
IDL> plotbreak, x, exp(x), breakpct=10
IDL> plotbreak, x, exp(x), breakpct=90
IDL> plotbreak, x, exp(-x), breakpct=10
IDL> plotbreak, x, exp(-x), breakpct=90
IDL> plotbreak, x, exp(-x), breakpct=90, _EXTRA_1={xticks:1}
IDL> plotbreak, x, -exp(-x), breakpct=90, _EXTRA_1={xticks:1}
IDL> plotbreak, x, -exp(x), breakpct=10, _EXTRA_0={xticks:1}
And of course sine waves and random functions all appear to work well
with this algorithm.
I won't post further updates here. The program (and code library) have
RSS feeds if you are interested in more...
-k.
|