comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Is there a way to plot with axis breaks in IDL?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Is there a way to plot with axis breaks in IDL? [message #70358] Thu, 01 April 2010 20:28 Go to next message
fututre.keyboard is currently offline  fututre.keyboard
Messages: 10
Registered: September 2009
Junior Member
I know this is rare when you need to do this kinda plot. But i'd
appreciate a lot if someone can point me to the right direction.
Thanks!

BTW: here is an example of axis break plot from Originlab's webpage.
http://www.originlab.com/index.aspx?s=8&lm=114&pid=1 020
Re: Is there a way to plot with axis breaks in IDL? [message #70376 is a reply to message #70358] Sun, 11 April 2010 00:17 Go to previous messageGo to next message
biophys is currently offline  biophys
Messages: 68
Registered: July 2004
Member
I recall I did something without using xyouts years ago when I was TA-
ing a physics class. It can do multiple breaks along both x and y axis
as well as overplot etc. I can dig it out from my old hard drive if
people are interested.

Cheers,
Yun

On Apr 8, 12:33 am, "fututre.keyboard" <future.keybo...@gmail.com>
wrote:
> Thanks for the implementation. It takes only a little tweak to make
> the plot useful. What I need to pay attention when tweaking are the
> tick- related stuff. The other thing is that I have to suppress the x-
> title/title and use xyouts to get a centered x-title/title. Although I
> don't need to break up y-axis, I would imagine a hard time to xyouts y-
> title in a usual orientation.
>
> E
>
> 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.
Re: Is there a way to plot with axis breaks in IDL? [message #70392 is a reply to message #70358] Thu, 08 April 2010 15:03 Go to previous messageGo to next message
mankoff is currently offline  mankoff
Messages: 131
Registered: March 2004
Senior Member
On Apr 8, 1:13 pm, "fututre.keyboard" <future.keybo...@gmail.com>
wrote:
> Great. Thanks! I didn't notice the changes in the code. I just noticed
> that there is an orientation keyword for xyouts. I am happy now.
>
> On Apr 8, 10:26 am, mankoff <mank...@gmail.com> wrote:
>
>> On Apr 8, 12:33 am, "fututre.keyboard" <future.keybo...@gmail.com>
>> wrote:
>
>>> Thanks for the implementation. It takes only a little tweak to make
>>> the plot useful. What I need to pay attention when tweaking are the
>>> tick- related stuff. The other thing is that I have to suppress the x-
>>> title/title and use xyouts to get a centered x-title/title. Although I
>>> don't need to break up y-axis, I would imagine a hard time to xyouts y-
>>> title in a usual orientation.
>
>>> E
>

I think I know what you're talking about. You might want to set !
fancy=1 in a startup file.
Re: Is there a way to plot with axis breaks in IDL? [message #70394 is a reply to message #70358] Thu, 08 April 2010 13:13 Go to previous messageGo to next message
fututre.keyboard is currently offline  fututre.keyboard
Messages: 10
Registered: September 2009
Junior Member
Great. Thanks! I didn't notice the changes in the code. I just noticed
that there is an orientation keyword for xyouts. I am happy now.

On Apr 8, 10:26 am, mankoff <mank...@gmail.com> wrote:
> On Apr 8, 12:33 am, "fututre.keyboard" <future.keybo...@gmail.com>
> wrote:
>
>> Thanks for the implementation. It takes only a little tweak to make
>> the plot useful. What I need to pay attention when tweaking are the
>> tick- related stuff. The other thing is that I have to suppress the x-
>> title/title and use xyouts to get a centered x-title/title. Although I
>> don't need to break up y-axis, I would imagine a hard time to xyouts y-
>> title in a usual orientation.
>
>> E
>
> TITLE and XTITLE are now handled correctly (I think). I'm not sure
> what you mean when you mention y-title and orientation.
>
> Feel free to follow up with me off-list.
>
>    -k.
Re: Is there a way to plot with axis breaks in IDL? [message #70401 is a reply to message #70358] Thu, 08 April 2010 10:26 Go to previous messageGo to next message
mankoff is currently offline  mankoff
Messages: 131
Registered: March 2004
Senior Member
On Apr 8, 12:33 am, "fututre.keyboard" <future.keybo...@gmail.com>
wrote:
> Thanks for the implementation. It takes only a little tweak to make
> the plot useful. What I need to pay attention when tweaking are the
> tick- related stuff. The other thing is that I have to suppress the x-
> title/title and use xyouts to get a centered x-title/title. Although I
> don't need to break up y-axis, I would imagine a hard time to xyouts y-
> title in a usual orientation.
>
> E
>

TITLE and XTITLE are now handled correctly (I think). I'm not sure
what you mean when you mention y-title and orientation.

Feel free to follow up with me off-list.

-k.
Re: Is there a way to plot with axis breaks in IDL? [message #70458 is a reply to message #70376] Mon, 12 April 2010 10:11 Go to previous messageGo to next message
mankoff is currently offline  mankoff
Messages: 131
Registered: March 2004
Senior Member
On Apr 11, 12:17 am, biophys <biop...@gmail.com> wrote:
> I recall I did something without using xyouts years ago when I was TA-
> ing a physics class. It can do multiple breaks along both x and y axis
> as well as overplot etc. I can dig it out from my old hard drive if
> people are interested.
>
> Cheers,
> Yun
>

I'm interested.

-k.
Re: Is there a way to plot with axis breaks in IDL? [message #70618 is a reply to message #70358] Tue, 27 April 2010 21:17 Go to previous message
biophys is currently offline  biophys
Messages: 68
Registered: July 2004
Member
Hi, David

Suppressing the entire axis would also erase the xtitle/ytitle. That's
what bothers me. I wanted it to be consistent when there is no breaks
at all. It may look like an overkill with this not so elegant
solution. Afterall, one could always use xyouts to draw the xtitle/
ytitle and fine tune the positions and charsize.

Best,
Yun

On Apr 27, 8:00 pm, David Fanning <n...@dfanning.com> wrote:
> biophys writes:
>> I added a new idldoc comment header in rst format and fixed a "ghost"
>> problem with PS output. Basically I use a plot command with no breaks
>> to determine the plot region and generate proper (x/y) titles. Then I
>> have to erase the plot except those titles with another plot using
>> background color. It works perfect for direct graphics but there will
>> be "ghost" tick labels in PS output due to none perfect overlapping. I
>> fixed it by patching with small background filled rectangles. It is
>> not elegant but works for me so far.
>
> It might be easier to "draw" the plot with invisible ink.
> Here is the Plot command I usually use:
>
>       Plot, xrange, yrange, POSITION=position, $
>         XSTYLE=5, YSTYLE=21, /NODATA, /NOERASE
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Is there a way to plot with axis breaks in IDL? [message #70619 is a reply to message #70358] Tue, 27 April 2010 20:00 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
biophys writes:

> I added a new idldoc comment header in rst format and fixed a "ghost"
> problem with PS output. Basically I use a plot command with no breaks
> to determine the plot region and generate proper (x/y) titles. Then I
> have to erase the plot except those titles with another plot using
> background color. It works perfect for direct graphics but there will
> be "ghost" tick labels in PS output due to none perfect overlapping. I
> fixed it by patching with small background filled rectangles. It is
> not elegant but works for me so far.

It might be easier to "draw" the plot with invisible ink.
Here is the Plot command I usually use:

Plot, xrange, yrange, POSITION=position, $
XSTYLE=5, YSTYLE=21, /NODATA, /NOERASE

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Is there a way to plot with axis breaks in IDL? [message #70620 is a reply to message #70458] Tue, 27 April 2010 19:45 Go to previous message
biophys is currently offline  biophys
Messages: 68
Registered: July 2004
Member
Ok, for those who are interested. I finally had sometime to hook up
one of those old ide drives and dig out the file.

I added a new idldoc comment header in rst format and fixed a "ghost"
problem with PS output. Basically I use a plot command with no breaks
to determine the plot region and generate proper (x/y) titles. Then I
have to erase the plot except those titles with another plot using
background color. It works perfect for direct graphics but there will
be "ghost" tick labels in PS output due to none perfect overlapping. I
fixed it by patching with small background filled rectangles. It is
not elegant but works for me so far.

Another issue is that ticklen can be very different when you have
uneven plotting segments. It seems that the ticklen is proportional to
the size of the plotting segment. I can scale the (major) ticklen with
xticklen/yticklen keyword(s). However, the minor ticks does not scale
accordingly.

Please visit the following site for source and documents and feel free
to mature the code as you see fit. I am not sure how long this server
will last since my boss had got another job a while ago. It would be
nice someone can help hosting the file. Comments and suggestions are
definitely welcome.

http://tinyurl.com/2aflnn2

Best,
Yun

On Apr 12, 10:11 am, mankoff <mank...@gmail.com> wrote:
> On Apr 11, 12:17 am, biophys <biop...@gmail.com> wrote:
>
>> I recall I did something without using xyouts years ago when I was TA-
>> ing a physics class. It can do multiple breaks along both x and y axis
>> as well as overplot etc. I can dig it out from my old hard drive if
>> people are interested.
>
>> Cheers,
>> Yun
>
> I'm interested.
>
>   -k.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: image contrast, bias a la DS9
Next Topic: Re: ms2gt MODIS reprojection toolkit

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:44:14 PDT 2025

Total time taken to generate the page: 0.01019 seconds