Ask Your Question
0

How to increase numer of internal decimal places on axis?

asked 2019-03-16 17:32:49 +0100

stockh0lm gravatar image

When ploting graphs with a small y-range it can happen that the whole y-axis shows the same number at the ticks. see attached pic.

how can i increase the number of decimal places?

the plot command i use is

plot([f, f_lower, f_upper],(x,0.2,0.99), color=['blue', 'red', 'green'], legend_label=['Wert ohne Fehler',  'untere Fehlerschranke', 'obere Fehlerschranke'], axes_labels=['Tiefe in Z-Richtung in m','$\\frac{4 \\, \\pi {{\\varphi_{ges}}}}{U}$'], figsize=8, title='all values have errors. but this is without seawater, just sediment', title_pos=(0.5,1.1)).save('JustSediment.png')

but i suppose i will just need to add a clever option (which i was unable to locate in this forum or the documentation).

C:\fakepath\JustSediment.png

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-03-16 20:45:04 +0100

vdelecroix gravatar image

Use custom ticks as mentioned in the documentation or question 7855 on ask. In your situation, something like this might work

sage: from matplotlib import ticker
sage: TT = ticker.FormatStrFormatter('%.7e')
sage: point2d([(0, 7.9123432e-12), (1, 7.9123471e-12), (2, 7.9123457e-12)], tick_formatter=[None,TT])

Though it is not very readable. I would advice you to translate the y-axis so that you actually see the difference on the first digit (in my case I would translate by 7.91234e-12).

edit flag offensive delete link more

Comments

would you please explain what you mean by "translate the y-axis"? how do you translate an axis?

stockh0lm gravatar imagestockh0lm ( 2019-03-16 23:50:11 +0100 )edit

I mean: change the y coordinate of your data by some amount so that the difference between the numbers is visible on the digits. For example with

sage: l = [1.23456721, 1.23456783, 1.23456752, 1.23456731, 1.23456711]

it is hard to tell quickly which one is bigger which one is smaller. On the other hand here it becomes evident

sage: [x - 1.234567 for x in l]
[2.10000000055999e-7,
 8.30000000062725e-7,
 5.19999999948340e-7,
 3.10000000114385e-7,
 1.09999999997612e-7]
vdelecroix gravatar imagevdelecroix ( 2019-03-17 12:02:07 +0100 )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

1 follower

Stats

Asked: 2019-03-16 17:32:49 +0100

Seen: 617 times

Last updated: Mar 16 '19