Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Backport PR #30162 on branch v3.10.x (TST: Fix runtime error checking NaN input to format_cursor_data)#30167

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletionslib/matplotlib/cbook.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2208,6 +2208,9 @@ def _g_sig_digits(value, delta):
Return the number of significant digits to %g-format *value*, assuming that
it is known with an error of *delta*.
"""
# For inf or nan, the precision doesn't matter.
if not math.isfinite(value):
return 0
if delta == 0:
if value == 0:
# if both value and delta are 0, np.spacing below returns 5e-324
Expand All@@ -2221,11 +2224,10 @@ def _g_sig_digits(value, delta):
# digits before the decimal point (floor(log10(45.67)) + 1 = 2): the total
# is 4 significant digits. A value of 0 contributes 1 "digit" before the
# decimal point.
# For inf or nan, the precision doesn't matter.
return max(
0,
(math.floor(math.log10(abs(value))) + 1 if value else 1)
- math.floor(math.log10(delta))) if math.isfinite(value) else 0
- math.floor(math.log10(delta)))


def _unikey_or_keysym_to_mplkey(unikey, keysym):
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp