问题
I have a function plotted using pyplot. When I move the cursor over the window, I can see the values for X and Y of the location of the cursor at the bottom-left of the window (display as, for example, x = 4.27567e+06 y = 6.98764e-09).
How can I change the number of significant digits of those values? I've tried playing with the axis settings and tick settings, but it doesn't seem to help.
As you can see in the example I gave above, right now the resolution is 6 significant digits, but I need resolution of 8 or more digits.
FYI, the array I am plotting has points separated by intervals much smaller than what I need to display, so that's not the issue.
Is there a command in matplotlib to do this?
Thanks.
回答1:
You can entirely customize the text that displays info about the cursor's current location:
ax = plt.gca()
ax.format_coord = lambda x,y: '%10d, %10d' % (x,y)
来源:https://stackoverflow.com/questions/31360360/increase-significant-digits-in-pyplot-cursor