Re: Trig plots auto-shifted (?) [message #81016] |
Thu, 02 August 2012 20:29 |
A J
Messages: 11 Registered: February 2012
|
Junior Member |
|
|
On 3 Aug, 12:27, David Fanning <n...@idlcoyote.com> wrote:
> A J writes:
>> Anyone know why IDL plots trig functions of negative numbers as
>> shifted to the positive?
>
>> Example:
>
>> x = -1. * dindgen(100)
>> y = sin(x)
>> plot, y, xrange=[-100,100]
>
>> plots the correct sine function, but over the xrange of [0,100] even
>> though the input xvalues are all negative. I know I could shift it
>> back, but I want to know why it is doing this. Any thoughts?
>
> Because if you only plot the dependent data, it
> creates the independent data like this:
>
> indep = Indgen(N_Elements(y))
>
> I think IDL has done that since the beginning of time. :-)
>
> Cheers,
>
> David
>
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.idlcoyote.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Yeah I figured that out jsut after I posted. Tried to remove the post,
but, damn, someone saw it first!
|
|
|
Re: Trig plots auto-shifted (?) [message #81018 is a reply to message #81016] |
Thu, 02 August 2012 19:27  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
A J writes:
> Anyone know why IDL plots trig functions of negative numbers as
> shifted to the positive?
>
> Example:
>
> x = -1. * dindgen(100)
> y = sin(x)
> plot, y, xrange=[-100,100]
>
> plots the correct sine function, but over the xrange of [0,100] even
> though the input xvalues are all negative. I know I could shift it
> back, but I want to know why it is doing this. Any thoughts?
Because if you only plot the dependent data, it
creates the independent data like this:
indep = Indgen(N_Elements(y))
I think IDL has done that since the beginning of time. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|