Ask Your Question

interact variable print formatting

asked 2011-10-09 19:59:36 -0500

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 15:54:19 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2011-10-09 23:53:04 -0500

Jason Grout gravatar image

updated 2011-10-10 00:31:36 -0500

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 08:55:11 -0500 )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-09 19:59:36 -0500

Seen: 1,022 times

Last updated: Oct 10 '11