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

Appearance settings

Commit 0dc4e43

Browse filesBrowse files
committed
Don't crash qt figure options on unknown marker styles.
Currently, if a plot uses a "custom" marker style (e.g., a mathtext string, `plt.plot([1, 2], ls="none", marker="$1/2$")`, or a n-gon, `marker=(7, 0)`), trying to open the qt figure options editor will crash the process because of an unhandled KeyError in `prepare_data` (at `canonical_init = name2short[d[init]]`). Instead, create an entry on-the-fly for that custom style.
1 parent 1652ed1 commit 0dc4e43
Copy full SHA for 0dc4e43

File tree

Expand file treeCollapse file tree

1 file changed

+2
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-0
lines changed

‎lib/matplotlib/backends/qt_editor/figureoptions.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/qt_editor/figureoptions.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ def prepare_data(d, init):
9393
FormLayout combobox, namely `[initial_name, (shorthand,
9494
style_name), (shorthand, style_name), ...]`.
9595
"""
96+
if init not in d:
97+
d = {**d, init: str(init)}
9698
# Drop duplicate shorthands from dict (by overwriting them during
9799
# the dict comprehension).
98100
name2short = {name: short for short, name in d.items()}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.