pygpibtoolkit/qt5/mpl.py

changeset 90
869de27dedc7
parent 89
61074a32808a
child 91
f2a8f688dbc0
--- a/pygpibtoolkit/qt5/mpl.py	Tue May 15 16:09:16 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-#!/usr/bin/env python
-# This program is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc.,
-# 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
-
-# stolen from:
-# embedding_in_qt4.py --- Simple Qt4 application embedding matplotlib canvases
-#
-# Copyright (C) 2005 Florent Rougon
-#               2006 Darren Dale
-#
-# This file is an example program for matplotlib. It may be used and
-# modified with no restriction; raw copies as well as modified versions
-# may be distributed without limitation.
-
-""" Copyright (c) 2007-2018 David Douard (Paris, FRANCE).
-http://www.logilab.org/project/pygpibtoolkit -- mailto:david.douard@sdfa3.org
-"""
-
-from PyQt5 import QtCore, QtWidgets
-
-from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as Canvas
-from matplotlib.figure import Figure
-
-
-class QMplCanvas(Canvas):
-    def __init__(self, parent=None, width=5, height=4, dpi=100):
-        self.fig = Figure(figsize=(width, height), dpi=dpi)
-        self.axes = self.fig.add_subplot(111)
-        # We want the axes cleared every time plot() is called
-        self.axes.hold(False)
-
-        super().__init__(self.fig)
-        self.setParent(parent)
-
-        self.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
-                           QtWidgets.QSizePolicy.Expanding)
-        self.updateGeometry()
-
-    def sizeHint(self):
-        w, h = self.get_width_height()
-        return QtCore.QSize(w, h)
-
-    def minimumSizeHint(self):
-        return QtCore.QSize(10, 10)
-
-    def plot(self, xdata, ydata, color="r"):
-        self.axes.plot(xdata, ydata, color)
-
-
-def main():
-    from PyQt5.QtWidgets import QApplication
-    app = QApplication([])
-    w = QMplCanvas()
-    w.plot([x for x in range(10)], [x*x for x in range(10)])
-    w.show()
-    app.exec_()
-
-
-if __name__ == '__main__':
-    main()

mercurial