Created
March 17, 2012 21:06
-
-
Save bertonha/2065271 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
os.environ['QT_API'] = 'pyside' | |
from matplotlib.figure import Figure | |
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg, \ | |
NavigationToolbar2QTAgg | |
class Plot_Area(FigureCanvasQTAgg): | |
def __init__(self, parent=None): | |
super(Plot_Area, self).__init__(Figure()) | |
self.setParent(parent) | |
self.axes = self.figure.add_subplot(111) | |
self.axes.hold(False) | |
self.toolbar = NavigationToolbar2QTAgg(self, self) | |
def plot_line(self, *args): | |
self.axes.plot(*args) | |
self.axes.axhline(color='k') | |
self.axes.grid(True) | |
self.draw() | |
if __name__ == '__main__': | |
from PySide.QtGui import QApplication | |
app = QApplication([]) | |
graf = Plot_Area() | |
graf.plot_line([-1, 1, 2, 3, 4]) | |
graf.show() | |
app.exec_() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment