[Matplotlib-users] [Newbie question] Is 0:3:100 possible?

2007-09-04 Thread Robert Dailey
Hi,

I come from using Matlab and I was just curious if it was possible to create
an arange from a quick for loop of numbers? For example:

0:3:100 would generate:
0, 3, 6, 9, 12, , 96, 99

And I would want this range to be in an arange() object. Is there a similar
way of doing this? Thanks.
-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [Newbie question] Is 0:3:100 possible?

2007-09-04 Thread Matthieu Brucher
Hi,

numpy.arange(0, 100, 3) perhaps ?

Matthieu

2007/9/4, Robert Dailey [EMAIL PROTECTED]:

 Hi,

 I come from using Matlab and I was just curious if it was possible to
 create an arange from a quick for loop of numbers? For example:

 0:3:100 would generate:
 0, 3, 6, 9, 12, , 96, 99

 And I would want this range to be in an arange() object. Is there a
 similar way of doing this? Thanks.

 -
 This SF.net email is sponsored by: Splunk Inc.
 Still grepping through log files to find problems?  Stop.
 Now Search log events and configuration files using AJAX and a browser.
 Download your FREE copy of Splunk now   http://get.splunk.com/
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [Newbie question] Is 0:3:100 possible?

2007-09-04 Thread Robert Dailey
Ah; Thanks guys. I thought 'arange' was a class, however it is a function. I
get it now. Sorry for the confusion!

On 9/4/07, Steve Lianoglou [EMAIL PROTECTED] wrote:

 On Sep 4, 2007, at 3:09 PM, Robert Dailey wrote:

  Hi,
 
  I come from using Matlab and I was just curious if it was possible
  to create an arange from a quick for loop of numbers? For example:
 
  0:3:100 would generate:
  0, 3, 6, 9, 12, , 96, 99

 In ipython's pylab mode:

 In [1]: arange(3,100,3)
 Out[1]:
 array([ 3,  6,  9, 12, 15, 18, 21, 24, 27, 30, 33, 36, 39, 42, 45,
 48, 51,
 54, 57, 60, 63, 66, 69, 72, 75, 78, 81, 84, 87, 90, 93, 96, 99])

  And I would want this range to be in an arange() object. Is there a
  similar way of doing this? Thanks.

 Not sure what you mean by an arange object, but arange returns a
 numpy array.

 HTH,
 -steve

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] [Newbie question] Is 0:3:100 possible?

2007-09-04 Thread Christopher Barker
Robert Dailey wrote:
 Ah; Thanks guys. I thought 'arange' was a class, however it is a 
 function. I get it now. Sorry for the confusion!

Just a note: most often (at least if you are working with floating point 
values) you want linspace, rather than arange:

  N.linspace(3, 99, 33)
array([  3.,   6.,   9.,  12.,  15.,  18.,  21.,  24.,  27.,  30.,  33.,
 36.,  39.,  42.,  45.,  48.,  51.,  54.,  57.,  60.,  63.,  66.,
 69.,  72.,  75.,  78.,  81.,  84.,  87.,  90.,  93.,  96.,  99.])

fewer surprises with floating point oddities.

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/ORR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

[EMAIL PROTECTED]

-
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now   http://get.splunk.com/
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users