significant-digits

Show decimal places and scientific notation on the axis of a matplotlib plot

Show decimal places and scientific notation on the axis Question: I am plotting some big numbers with matplotlib in a pyqt program using python 2.7. I have a y-axis that ranges from 1e+18 to 3e+18 (usually). I’d like to see each tick mark show values in scientific notation and with 2 decimal places. For example …

Total answers: 2

How to round a number to significant figures in Python

How to round a number to significant figures in Python Question: I need to round a float to be displayed in a UI. e.g, to one significant figure: 1234 -> 1000 0.12 -> 0.1 0.012 -> 0.01 0.062 -> 0.06 6253 -> 6000 1999 -> 2000 Is there a nice way to do this using …

Total answers: 26