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

Home » Public Forums » archive » Re: Trig plots auto-shifted (?)
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
Re: Trig plots auto-shifted (?) [message #81016] Thu, 02 August 2012 20:29
A J is currently offline  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 Go to previous message
David Fanning is currently offline  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.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: imcontour no longer plotting in color
Next Topic: max_value/min_value in the x-axis?

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

Current Time: Wed Oct 08 19:04:56 PDT 2025

Total time taken to generate the page: 0.01846 seconds