Last active
April 9, 2016 00:02
-
-
Save santiago-salas-v/db0e200fd83a5817a159763a4eb89a2d to your computer and use it in GitHub Desktop.
This file contains 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 | |
import sys | |
import logging | |
import re | |
import pandas as pd | |
import numpy as np | |
import scipy as sp | |
import csv | |
import bisect | |
import uuid | |
import matplotlib | |
import colormaps | |
matplotlib.use('Qt4Agg') | |
matplotlib.rcParams['backend.qt4'] = 'PySide' | |
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas | |
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar | |
from matplotlib.figure import Figure | |
from PySide import QtGui, QtCore | |
from functools import partial | |
from mat_Zerlegungen import gausselimination | |
from datetime import datetime | |
from mpldatacursor import datacursor | |
def main(): | |
app = QtGui.QApplication.instance() # checks if QApplication already exists | |
if not app: # create QApplication if it doesnt exist | |
app = QtGui.QApplication(sys.argv) | |
# Init | |
widg1 = QtGui.QGroupBox(parent=None) | |
vertical_layout = QtGui.QVBoxLayout(widg1) | |
fig1 = Figure(dpi=72, facecolor=(1, 1, 1), | |
edgecolor=(0, 0, 0)) | |
canv1 = FigureCanvas(fig1) | |
ax1 = fig1.add_subplot(111) | |
ax1.set_xlim(-0.06, 0.06) | |
ax1.set_ylim(3.35000000e-15, 3.75000000e-15) | |
ax1.autoscale(True) | |
transform = ax1.transData | |
arrow_head = (0.5, 0.15302574986800177) | |
arrow_tail = (0.0, 0.30605149973599999) | |
arrow_kw = { | |
'mutation_scale': 20, | |
'color': [ | |
0.590734, | |
0.152563, | |
0.40029], | |
'linewidth': 1.0, | |
'arrowstyle': '->'} | |
vertical_layout.addWidget(canv1) | |
widg1.show() | |
file1 = open('output_1_ignorethis.txt', 'w') | |
file1.write(str(transform)) | |
file1.close() | |
print transform | |
print 'plotted successfully!' | |
p = matplotlib.patches.FancyArrowPatch( | |
arrow_tail, arrow_head, transform=transform, | |
**arrow_kw) | |
ax1.add_patch(p) | |
ax1.relim() | |
ax1.autoscale_view() | |
canv1.draw() | |
print 'patch plotted successfully!' | |
# Main Loop | |
app.exec_() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Lines 36 and 37 generate an endless loop.
==>> Fixed by adding line 39: ax1.autoscale(True)