Re: starting point of dashed lines [message #65725] |
Mon, 23 March 2009 07:54  |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
On Mar 23, 10:22 am, Paolo <pgri...@gmail.com> wrote:
> Hi Jeremy,
>
> yes, this is one of the things I dislike about plot,
> that such details as the phase of dashes is totally
> out of control.
>
> In fact, at some point I wrote a little procedure to
> overplot with dashes of specified length and phase...
> I should still have it I believe, and I can dig it up for
> you if that would be useful...
>
> Ciao,
> Paolo
>
> Jeremy Bailin wrote:
>> On Mar 22, 12:28 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
>>> Any sort of dashed and/or dotted linestyle (i.e. anything other than
>>> linetsyle=0) has some natural "starting point" or phase. Is there a
>>> way to manually reset it?
>
>>> My specific problem is that I'm generating some plots in .png files
>>> that are going to be stuck together as an animation, including a
>>> dashed line that should be identical in each plot. However, it isn't -
>>> at least, not when plotted to the Z buffer! Here is some code that
>>> demonstrates this:
>
>>> set_plot, 'z'
>>> plot, [0,1], [-0.5,0.5]
>>> erase
>>> oplot, [0,1], [0,0], lines=2
>>> write_png, 'test1.png', tvrd()
>>> erase
>>> oplot, [0,1], [0,0], lines=2
>>> write_png, 'test2.png', tvrd()
>
>>> If you compare the two .png files, you'll see that the dashing is
>>> shifted slightly. However, if I do this with set_plot,'x' instead, it
>>> works fine!
>
>>> -Jeremy.
>
>> Incidentally, the easiest way to see this is to omit the second
>> "erase" command in my example - then the actual size of the dashes
>> appears to get bigger as out-of-phase dashes get overplotted on top of
>> each other.
>
>> Anyone?
>
>> -Jeremy.
>
>
Would love it. I've worked around this particular issue today by using
a gray line instead, but I can easily see it coming up again.
What bugs me is that there must be *some* internal variable that is
telling IDL what phase to start at. So how can we get at it??
-Jeremy.
|
|
|
Re: starting point of dashed lines [message #65728 is a reply to message #65725] |
Mon, 23 March 2009 07:22   |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
Hi Jeremy,
yes, this is one of the things I dislike about plot,
that such details as the phase of dashes is totally
out of control.
In fact, at some point I wrote a little procedure to
overplot with dashes of specified length and phase...
I should still have it I believe, and I can dig it up for
you if that would be useful...
Ciao,
Paolo
Jeremy Bailin wrote:
> On Mar 22, 12:28 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
>> Any sort of dashed and/or dotted linestyle (i.e. anything other than
>> linetsyle=0) has some natural "starting point" or phase. Is there a
>> way to manually reset it?
>>
>> My specific problem is that I'm generating some plots in .png files
>> that are going to be stuck together as an animation, including a
>> dashed line that should be identical in each plot. However, it isn't -
>> at least, not when plotted to the Z buffer! Here is some code that
>> demonstrates this:
>>
>> set_plot, 'z'
>> plot, [0,1], [-0.5,0.5]
>> erase
>> oplot, [0,1], [0,0], lines=2
>> write_png, 'test1.png', tvrd()
>> erase
>> oplot, [0,1], [0,0], lines=2
>> write_png, 'test2.png', tvrd()
>>
>> If you compare the two .png files, you'll see that the dashing is
>> shifted slightly. However, if I do this with set_plot,'x' instead, it
>> works fine!
>>
>> -Jeremy.
>
> Incidentally, the easiest way to see this is to omit the second
> "erase" command in my example - then the actual size of the dashes
> appears to get bigger as out-of-phase dashes get overplotted on top of
> each other.
>
> Anyone?
>
> -Jeremy.
|
|
|
Re: starting point of dashed lines [message #65735 is a reply to message #65728] |
Sun, 22 March 2009 14:39   |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
On Mar 22, 12:28 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
> Any sort of dashed and/or dotted linestyle (i.e. anything other than
> linetsyle=0) has some natural "starting point" or phase. Is there a
> way to manually reset it?
>
> My specific problem is that I'm generating some plots in .png files
> that are going to be stuck together as an animation, including a
> dashed line that should be identical in each plot. However, it isn't -
> at least, not when plotted to the Z buffer! Here is some code that
> demonstrates this:
>
> set_plot, 'z'
> plot, [0,1], [-0.5,0.5]
> erase
> oplot, [0,1], [0,0], lines=2
> write_png, 'test1.png', tvrd()
> erase
> oplot, [0,1], [0,0], lines=2
> write_png, 'test2.png', tvrd()
>
> If you compare the two .png files, you'll see that the dashing is
> shifted slightly. However, if I do this with set_plot,'x' instead, it
> works fine!
>
> -Jeremy.
Incidentally, the easiest way to see this is to omit the second
"erase" command in my example - then the actual size of the dashes
appears to get bigger as out-of-phase dashes get overplotted on top of
each other.
Anyone?
-Jeremy.
|
|
|
Re: starting point of dashed lines [message #65736 is a reply to message #65735] |
Sun, 22 March 2009 10:32   |
Jeremy Bailin
Messages: 618 Registered: April 2008
|
Senior Member |
|
|
On Mar 22, 12:28 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
> Any sort of dashed and/or dotted linestyle (i.e. anything other than
> linetsyle=0) has some natural "starting point" or phase. Is there a
> way to manually reset it?
>
> My specific problem is that I'm generating some plots in .png files
> that are going to be stuck together as an animation, including a
> dashed line that should be identical in each plot. However, it isn't -
> at least, not when plotted to the Z buffer! Here is some code that
> demonstrates this:
>
> set_plot, 'z'
> plot, [0,1], [-0.5,0.5]
> erase
> oplot, [0,1], [0,0], lines=2
> write_png, 'test1.png', tvrd()
> erase
> oplot, [0,1], [0,0], lines=2
> write_png, 'test2.png', tvrd()
>
> If you compare the two .png files, you'll see that the dashing is
> shifted slightly. However, if I do this with set_plot,'x' instead, it
> works fine!
>
> -Jeremy.
I should mention, tested in both:
{ ppc darwin unix Mac OS X 7.0.4 Sep 3 2008 32 64}
and
{ x86 linux unix linux 6.4 Apr 26 2007 32 64}
-Jeremy.
|
|
|
Re: starting point of dashed lines [message #65869 is a reply to message #65725] |
Mon, 23 March 2009 10:32  |
pgrigis
Messages: 436 Registered: September 2007
|
Senior Member |
|
|
Ok,
you should try:
http://hea-www.cfa.harvard.edu/~pgrigis/idl_stuff/pg_dashedl ineoplot.pro
This uses fcheck.pro from solarsoft:
http://sohowww.nascom.nasa.gov/solarsoft/gen/idl/util/fcheck .pro
Here's an example.
p1=[1,1] & p2=[5,3]
plot,[0,0],xrange=[0,10],yrange=[0,7],/iso
pg_dashedlineoplot,p1,p2,dashlen=0.05,spacelen=0.01,phase=0. 0
This works only for straight line segments! Therefore,
not extremly useful. Also the definition of the dash
lengths may not be the most intuitive...
Since this was not really built with wide distribution in mind,
the usual caveats apply (use at your own risk etc.), but
let us know if it is useful for you. I most certainly did not
perform extensive tests.
Ciao,
Paolo
Jeremy Bailin wrote:
> On Mar 23, 10:22 am, Paolo <pgri...@gmail.com> wrote:
>> Hi Jeremy,
>>
>> yes, this is one of the things I dislike about plot,
>> that such details as the phase of dashes is totally
>> out of control.
>>
>> In fact, at some point I wrote a little procedure to
>> overplot with dashes of specified length and phase...
>> I should still have it I believe, and I can dig it up for
>> you if that would be useful...
>>
>> Ciao,
>> Paolo
>>
>> Jeremy Bailin wrote:
>>> On Mar 22, 12:28 pm, Jeremy Bailin <astroco...@gmail.com> wrote:
>>>> Any sort of dashed and/or dotted linestyle (i.e. anything other than
>>>> linetsyle=0) has some natural "starting point" or phase. Is there a
>>>> way to manually reset it?
>>
>>>> My specific problem is that I'm generating some plots in .png files
>>>> that are going to be stuck together as an animation, including a
>>>> dashed line that should be identical in each plot. However, it isn't -
>>>> at least, not when plotted to the Z buffer! Here is some code that
>>>> demonstrates this:
>>
>>>> set_plot, 'z'
>>>> plot, [0,1], [-0.5,0.5]
>>>> erase
>>>> oplot, [0,1], [0,0], lines=2
>>>> write_png, 'test1.png', tvrd()
>>>> erase
>>>> oplot, [0,1], [0,0], lines=2
>>>> write_png, 'test2.png', tvrd()
>>
>>>> If you compare the two .png files, you'll see that the dashing is
>>>> shifted slightly. However, if I do this with set_plot,'x' instead, it
>>>> works fine!
>>
>>>> -Jeremy.
>>
>>> Incidentally, the easiest way to see this is to omit the second
>>> "erase" command in my example - then the actual size of the dashes
>>> appears to get bigger as out-of-phase dashes get overplotted on top of
>>> each other.
>>
>>> Anyone?
>>
>>> -Jeremy.
>>
>>
>
> Would love it. I've worked around this particular issue today by using
> a gray line instead, but I can easily see it coming up again.
>
> What bugs me is that there must be *some* internal variable that is
> telling IDL what phase to start at. So how can we get at it??
>
> -Jeremy.
|
|
|