From a75f3475f2a6dacfd28f5469ae96f68e3c5fc5df Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 1 Oct 2024 09:59:01 -0400 Subject: [PATCH] Fix plotting warnings in Pytest, add news for removal of six support (#215) * Add news and fix warnings * Add back original file content --- news/six.rst | 23 ++++++++++++++++++++++ news/warning.rst | 23 ++++++++++++++++++++++ src/diffpy/pdfgui/gui/extendedplotframe.py | 7 ++++--- 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 news/six.rst create mode 100644 news/warning.rst diff --git a/news/six.rst b/news/six.rst new file mode 100644 index 00000000..9f5136ce --- /dev/null +++ b/news/six.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* six dependency in run.txt + +**Fixed:** + +* + +**Security:** + +* diff --git a/news/warning.rst b/news/warning.rst new file mode 100644 index 00000000..06065114 --- /dev/null +++ b/news/warning.rst @@ -0,0 +1,23 @@ +**Added:** + +* + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* two warnings with (1) linestyle redundantly defined and (2) no artists with labels found to put in legend + +**Security:** + +* diff --git a/src/diffpy/pdfgui/gui/extendedplotframe.py b/src/diffpy/pdfgui/gui/extendedplotframe.py index bdc65f23..b9962451 100644 --- a/src/diffpy/pdfgui/gui/extendedplotframe.py +++ b/src/diffpy/pdfgui/gui/extendedplotframe.py @@ -182,9 +182,10 @@ def insertCurve(self, xData, yData, style): style -- the way curve should be plotted return: internal reference to the newly added curve """ - stylestr, properties = self.__translateStyles(style) - curveRef = self.subplot.plot(xData, yData, stylestr, **properties)[0] - self.subplot.legend(**legendBoxProperties()) + _, properties = self.__translateStyles(style) + curveRef = self.subplot.plot(xData, yData, **properties)[0] + if "legend" in style: + self.subplot.legend(**legendBoxProperties()) try: self.datalims[curveRef] = (min(xData), max(xData), min(yData), max(yData)) except ValueError: