From 66a8ac027efedc5e3667f5ed5832b7d4d9e8e1ff Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 6 May 2015 08:18:59 -0400 Subject: [PATCH 1/2] FIX : do not pass empty curve list through If there are lines on the Axes, but they are all labeled '_nolegend_', treat as if there are no lines on the Axes. Closes #4323 --- lib/matplotlib/backends/qt_editor/figureoptions.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/matplotlib/backends/qt_editor/figureoptions.py b/lib/matplotlib/backends/qt_editor/figureoptions.py index 76920a7e62b0..b24bf74a8304 100644 --- a/lib/matplotlib/backends/qt_editor/figureoptions.py +++ b/lib/matplotlib/backends/qt_editor/figureoptions.py @@ -87,6 +87,8 @@ def figure_edit(axes, parent=None): ('Edgecolor', line.get_markeredgecolor()), ] curves.append([curvedata, label, ""]) + # make sure that there is at least one displayed curve + has_curve = bool(curves) datalist = [(general, "Axes", "")] if has_curve: From 3f316773a9ece64635d0c1b49a5a0b4e0ad66afe Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Wed, 6 May 2015 08:34:26 -0400 Subject: [PATCH 2/2] FIX : handle color better it qt editor Convert all line colors to hex before passing into the form layout. Closes #4410 --- lib/matplotlib/backends/qt_editor/figureoptions.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/matplotlib/backends/qt_editor/figureoptions.py b/lib/matplotlib/backends/qt_editor/figureoptions.py index b24bf74a8304..0818363d33c6 100644 --- a/lib/matplotlib/backends/qt_editor/figureoptions.py +++ b/lib/matplotlib/backends/qt_editor/figureoptions.py @@ -17,6 +17,7 @@ import matplotlib.backends.qt_editor.formlayout as formlayout from matplotlib.backends.qt_compat import QtGui from matplotlib import markers +from matplotlib.colors import colorConverter, rgb2hex def get_icon(name): @@ -73,18 +74,21 @@ def figure_edit(axes, parent=None): curvelabels = sorted(linedict.keys()) for label in curvelabels: line = linedict[label] + color = rgb2hex(colorConverter.to_rgb(line.get_color())) + ec = rgb2hex(colorConverter.to_rgb(line.get_markeredgecolor())) + fc = rgb2hex(colorConverter.to_rgb(line.get_markerfacecolor())) curvedata = [('Label', label), sep, (None, 'Line'), ('Style', [line.get_linestyle()] + linestyles), ('Width', line.get_linewidth()), - ('Color', line.get_color()), + ('Color', color), sep, (None, 'Marker'), ('Style', [line.get_marker()] + markers), ('Size', line.get_markersize()), - ('Facecolor', line.get_markerfacecolor()), - ('Edgecolor', line.get_markeredgecolor()), + ('Facecolor', fc), + ('Edgecolor', ec), ] curves.append([curvedata, label, ""]) # make sure that there is at least one displayed curve