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 9764da1

Browse filesBrowse files
committed
Add separate drawstyles options to Qt figureoptions dialog
This fixes #4447 where it was reported that it is impossible to undo a step drawstyle using the Qt figureoptions dialog. The step draw style was applied as a linestyle (which is permitted in the API) but undo 'default' option was not included in the list. However adding the 'default' to the linestyles would mean enabling step and changing the linstyle would require the dialog to be reopened. Here instead a separate option set is created for draw style (and Style is renamed to Line Style). There is also a change of indentation for the line: has_curve = bool(curves) which was not indented into the correct block. This caused an error on any figures without visible lines.
1 parent d58a2a5 commit 9764da1
Copy full SHA for 9764da1

File tree

Expand file treeCollapse file tree

1 file changed

+12
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-5
lines changed

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

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/qt_editor/figureoptions.py
+12-5Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,13 @@ def get_icon(name):
2929
'--': 'Dashed',
3030
'-.': 'DashDot',
3131
':': 'Dotted',
32-
'steps': 'Steps',
3332
'none': 'None',
3433
}
3534

35+
DRAWSTYLES = {'default': 'Default',
36+
'steps': 'Steps',
37+
}
38+
3639
MARKERS = markers.MarkerStyle.markers
3740

3841

@@ -70,6 +73,7 @@ def figure_edit(axes, parent=None):
7073
linedict[label] = line
7174
curves = []
7275
linestyles = list(six.iteritems(LINESTYLES))
76+
drawstyles = list(six.iteritems(DRAWSTYLES))
7377
markers = list(six.iteritems(MARKERS))
7478
curvelabels = sorted(linedict.keys())
7579
for label in curvelabels:
@@ -80,7 +84,8 @@ def figure_edit(axes, parent=None):
8084
curvedata = [('Label', label),
8185
sep,
8286
(None, '<b>Line</b>'),
83-
('Style', [line.get_linestyle()] + linestyles),
87+
('Line Style', [line.get_linestyle()] + linestyles),
88+
('Draw Style', [line.get_drawstyle()] + drawstyles),
8489
('Width', line.get_linewidth()),
8590
('Color', color),
8691
sep,
@@ -91,8 +96,9 @@ def figure_edit(axes, parent=None):
9196
('Edgecolor', ec),
9297
]
9398
curves.append([curvedata, label, ""])
94-
# make sure that there is at least one displayed curve
95-
has_curve = bool(curves)
99+
100+
# make sure that there is at least one displayed curve
101+
has_curve = bool(curves)
96102

97103
datalist = [(general, "Axes", "")]
98104
if has_curve:
@@ -120,11 +126,12 @@ def apply_callback(data):
120126
# Set / Curves
121127
for index, curve in enumerate(curves):
122128
line = linedict[curvelabels[index]]
123-
label, linestyle, linewidth, color, \
129+
label, linestyle, drawstyle, linewidth, color, \
124130
marker, markersize, markerfacecolor, markeredgecolor \
125131
= curve
126132
line.set_label(label)
127133
line.set_linestyle(linestyle)
134+
line.set_drawstyle(drawstyle)
128135
line.set_linewidth(linewidth)
129136
line.set_color(color)
130137
if marker is not 'none':

0 commit comments

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