Ask Your Question

interact variable print formatting

asked 2011-10-10 02:59:36 +0200

Gökhan Sever gravatar image


Say that I have a simple interact function shown as below:

def myplot(u=(0.5,(0.1,10)), R=(20e-6,(20e-6,1000e-6))):
    #plotting code

Is there a way to print formatting of these variables in the interact zone; 2 digit float for u and e-form for the R. Currently I see both variables as many digit outputs.


edit retag flag offensive close merge delete


As you pointed out, same question at - just for reference for anyone else coming.

kcrisman gravatar imagekcrisman ( 2012-07-10 22:54:19 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2011-10-10 06:53:04 +0200

Jason Grout gravatar image

updated 2011-10-10 07:31:36 +0200

See the printf-like python string formatting options here. As an example:

sage: "%0.2f"%pi
sage: "%e"%pi
edit flag offensive delete link more


Hmm, this doesn't answer what I asked for. please scroll down to the last example. Floating point sliders are not well formatted. Can we modify them with string formatters?

Gökhan Sever gravatar imageGökhan Sever ( 2011-10-10 15:55:11 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2011-10-10 02:59:36 +0200

Seen: 1,992 times

Last updated: Oct 10 '11