8000 Merge pull request #10878 from ocastany/master · matplotlib/matplotlib@5e52ce1 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5e52ce1

Browse files
authored
Merge pull request #10878 from ocastany/master
Change hardcoded brackets for Toolbar message
2 parents a4139ae + 9ecc264 commit 5e52ce1

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

lib/matplotlib/artist.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,8 +1042,9 @@ def format_cursor_data(self, data):
10421042
data[0]
10431043
except (TypeError, IndexError):
10441044
data = [data]
1045-
return ', '.join('{:0.3g}'.format(item) for item in data if
1046-
isinstance(item, (np.floating, np.integer, int, float)))
1045+
data_str = ', '.join('{:0.3g}'.format(item) for item in data if
1046+
isinstance(item, (np.floating, np.integer, int, float)))
1047+
return "[" + data_str + "]"
10471048

10481049
@property
10491050
def mouseover(self):

lib/matplotlib/backend_bases.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2860,7 +2860,9 @@ def mouse_move(self, event):
28602860
if a is not event.inaxes.patch:
28612861
data = a.get_cursor_data(event)
28622862
if data is not None:
2863-
s += ' [%s]' % a.format_cursor_data(data)
2863+
data_str = a.format_cursor_data(data)
2864+
if data_str is not None:
2865+
s = s + ' ' + data_str
28642866

28652867
if len(self.mode):
28662868
self.set_message('%s, %s' % (self.mode, s))

lib/matplotlib/backend_tools.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,9 @@ def send_message(self, event):
344344
if a is not event.inaxes.patch:
345345
data = a.get_cursor_data(event)
346346
if data is not None:
347-
s += ' [%s]' % a.format_cursor_data(data)
347+
data_str = a.format_cursor_data(data)
348+
if data_str is not None:
349+
s = s + ' ' + data_str
348350

349351
message = s
350352
self.toolmanager.message_event(message, self)

0 commit comments

Comments
 (0)
0