Re: scientific notation in legend (pylab)

2012-01-18 Thread Jason Friedman
> thank you, I am trying to learn python, but I am having a hard to find
> a good introduction to it.

Try this:
http://docs.python.org/py3k/tutorial/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: scientific notation in legend (pylab)

2012-01-18 Thread simona bellavista
thank you, I am trying to learn python, but I am having a hard to find
a good introduction to it.

On Jan 15, 3:27 am, Jason Friedman  wrote:
>
> Not sure why legend annotations makes the problem different, but
> perhaps this is a start:
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: scientific notation in legend (pylab)

2012-01-14 Thread Jason Friedman
> I I would like to have numbers expressed in scientific notation in
> legend annotations. Does anybody know how to do that?
>

Not sure why legend annotations makes the problem different, but
perhaps this is a start:

$ python3
Python 3.2 (r32:88445, Jun 11 2011, 10:38:04)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print("{:e}".format(1000))
1.00e+03

http://docs.python.org/library/string.html
-- 
http://mail.python.org/mailman/listinfo/python-list



Re: Scientific Notation

2005-12-04 Thread Dustan
Thanks for your help, Alex, Roy and Jorge. I'm new to Python, and
programming in general, which might explain my lack of knowledge,
Fredrick.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Scientific Notation

2005-12-04 Thread Fredrik Lundh
> > > You mean something like:
> > >
> > > >>> print '%e' % (1e50)
> > > 1.00e+50
> > >
> > > ...?
>
> > No, I mean given a big number, such as
> > 1000, convert it into
> > scientific notation.
>
> It's the same.
>
> >>> print "%e" % 1000
> 1.00e+51

one would have assumed that someone who *prefers* to use scientific notation
for large numbers would in fact know that, but the usenet never ceases to sur-
prise me...





-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Scientific Notation

2005-12-03 Thread Jorge Godoy
"Dustan" <[EMAIL PROTECTED]> writes:

> No, I mean given a big number, such as
> 1000, convert it into
> scientific notation.

It's the same.

>>> print "%e" % 1000
1.00e+51


-- 
Jorge Godoy  <[EMAIL PROTECTED]>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Scientific Notation

2005-12-03 Thread Alex Martelli
Roy Smith <[EMAIL PROTECTED]> wrote:

> In article <[EMAIL PROTECTED]>,
>  "Dustan" <[EMAIL PROTECTED]> wrote:
> 
> > 1000
> 
> >>> print "%e" % 1000
> 1.00e+51

Exactly: the "%e" builds a ``scientific-notation" string from whatever
number you're formatting that way (big or small).  You can also use %g
if what you want is fixed-point notation within a certain range and
scientific notations only for numbers OUTSIDE that range, as in:

>>> print '%g' % 10**5
10
>>> print '%g' % 10**50
1e+50


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Scientific Notation

2005-12-03 Thread Roy Smith
In article <[EMAIL PROTECTED]>,
 "Dustan" <[EMAIL PROTECTED]> wrote:

> 1000

>>> print "%e" % 1000
1.00e+51
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Scientific Notation

2005-12-03 Thread Dustan
No, I mean given a big number, such as
1000, convert it into
scientific notation.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Scientific Notation

2005-12-03 Thread Alex Martelli
Dustan <[EMAIL PROTECTED]> wrote:

> How can I get a number into scientific notation? I have a preference
> for the format '1 E 50' (as an example), but if it's well known, it
> works.

You mean something like:

>>> print '%e' % (1e50)
1.00e+50

...?


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list