-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathfigure_editor.py
42 lines (30 loc) · 1.07 KB
/
figure_editor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
"""
Module plotshop.fig_editor.main: Figure Editor Command Line
-------------------------------------------------------------------
Commandline launcher/wrapper for the advanced qt-gui for matpoltlib.
Currently starts a testing figure.
"""
import sys
from PyQt5 import QtWidgets
from plotshop.fig_editor.main_window import MainWindow
def _quick_figure():
""" Create a quick testing figure """
import matplotlib.pyplot as plt
fig = plt.figure()
plt.text(.5, .5, "Hallo")
plt.errorbar(range(3), range(3), yerr=range(3), xerr=range(3), capsize=3)
plt.plot([0, 3], [0, 5], color="red")
return fig
# Main #######################################################################
def main(fig=None):
""" Prepares QT-environment and starts the editor. """
app = QtWidgets.QApplication(sys.argv)
app.setStyle("fusion")
form = MainWindow(fig)
form.show()
app.exec_()
return form.get_figure()
# Script Mode #################################################################
if __name__ == "__main__":
# main(_quick_figure())
main()