Postscript plots squished and a plot tick problem. [message #15948] |
Sat, 26 June 1999 00:00  |
Grady Daub
Messages: 22 Registered: June 1999
|
Junior Member |
|
|
When I make a postscript file with IDL, it thinks that the middle of the
page is the bottom of the page. Is this a common problem?
Also, there's another problem.
Making line plots seems to have gone wrong. Even if I specify
XTICKV,XTICKS,XTICKNAME,XRANGE, all that stuff, the first number is
ALWAYS zero.
I can't get any plot without the first value being zero. So, if I want a
plot of (value) zero to whatever, it's ok, except if I want the first
tick value to be, say, 10. What I get is a number 10 superimposed
on-top-of a number zero ("0"). Kinda looks like a squished "100".
If I set the first value to, say, 200 to 220, the 200-220 tickmarks are
way over on the right of the plot and a zero is on the left end, like it
thinks the plot should start at zero (which it's doing.). >:-<
This is a new thing that JUST popped up and I've been doing nothin
different.
The only way to get rid of the zero is to set XTICKFORMAT not to display
numbers, although, the plot still starts at zero.
|
|
|
Re: Postscript plots squished and a plot tick problem. [message #16105 is a reply to message #15948] |
Mon, 28 June 1999 00:00   |
Harald Frey
Messages: 41 Registered: March 1997
|
Member |
|
|
Grady Daub wrote:
> When I make a postscript file with IDL, it thinks that the middle of the
> page is the bottom of the page. Is this a common problem?
>
> Also, there's another problem.
>
> Making line plots seems to have gone wrong. Even if I specify
> XTICKV,XTICKS,XTICKNAME,XRANGE, all that stuff, the first number is
> ALWAYS zero.
>
> I can't get any plot without the first value being zero. So, if I want a
> plot of (value) zero to whatever, it's ok, except if I want the first
> tick value to be, say, 10. What I get is a number 10 superimposed
> on-top-of a number zero ("0"). Kinda looks like a squished "100".
>
> If I set the first value to, say, 200 to 220, the 200-220 tickmarks are
> way over on the right of the plot and a zero is on the left end, like it
> thinks the plot should start at zero (which it's doing.). >:-<
>
> This is a new thing that JUST popped up and I've been doing nothin
> different.
> The only way to get rid of the zero is to set XTICKFORMAT not to display
> numbers, although, the plot still starts at zero.
1. As David already wrote, the default is the middle of the page and you
have to set the yoffset in the device command to the appropriate value.
2. You did not provide a sample program but what I assume happens here is
that you improperly use the xticks and xtichv in your call.
Just try this
a=findgen(20)+9.
plot,a,a,xticks=5,xtickv=findgen(6)*4+9
But if you try
plot,a,a,xticks=6,xtickv=findgen(6)*4+9
you will always start at 0 and in yout PS output x-values may be plotted
one on top of the other.
Harald Frey
hfrey@ssl.berkeley.edu
|
|
|
|
Re: Postscript plots squished and a plot tick problem. [message #16138 is a reply to message #15948] |
Fri, 02 July 1999 00:00  |
Grady Daub
Messages: 22 Registered: June 1999
|
Junior Member |
|
|
Yeah. I figured that. I was going for a more philosophical answer. :-)
I've now changed my code to reflect floating-point math and it works
swell.
Now, I'll remember to keep track of that sort of thing.
I think that remembering if something is going to be float or integer or
whatever may run a close second to "device, decomposed=0" for IDL
programming tip of the year.
David Fanning wrote:
> Grady Daub (gadZOOKS8371@garnet.acns.fsuMMER.edu) writes:
>
>> I've found the evil badness that has caused all this pain.
>>
>> It is:
>>
>> In real life, 1/4 = 0.25
>> In IDL, 1/4 = 0
>
> Integer arithmetic, would be my guess. :-)
>
|
|
|
|
Re: Postscript plots squished and a plot tick problem. [message #16140 is a reply to message #15948] |
Fri, 02 July 1999 00:00  |
Grady Daub
Messages: 22 Registered: June 1999
|
Junior Member |
|
|
I just wrote an entirely new program and the "always starting at zero" problem
is happening again. (I hope the problem is the same for both programs.)
After much experimenting and complianing and general disgust, I think I have
discovered the problem.
My XTICKV values were:
39047.2 39047.2 39047.2 39047.2 41067.2
But, this didn't seem to affect the plot. IDL just made up it's own tick
values. (Which, incidentally, were the ones I wanted.)
I then tried to put back all the stuff I took out while experimenting. I could
only reproduce the "always starting at zero" problem by making
XTICKV=XTICKV(k), where k comes from "for k=..."
Your guess at my problem seems to have been correct.
I've found the evil badness that has caused all this pain.
It is:
In real life, 1/4 = 0.25
In IDL, 1/4 = 0
:-(
Can somebody tell me why?
Harald Frey wrote:
> 2. You did not provide a sample program but what I assume happens here is
> that you improperly use the xticks and xtichv in your call.
>
> Just try this
> a=findgen(20)+9.
> plot,a,a,xticks=5,xtickv=findgen(6)*4+9
>
> But if you try
>
> plot,a,a,xticks=6,xtickv=findgen(6)*4+9
>
> you will always start at 0 and in yout PS output x-values may be plotted
> one on top of the other.
|
|
|