-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathplot.py
More file actions
66 lines (56 loc) · 2.07 KB
/
plot.py
File metadata and controls
66 lines (56 loc) · 2.07 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
def plot_traces(mode, xlabel='Time (ms)'):
gs = gridspec.GridSpec(4, 1)
fig = plt.figure()
axi = fig.add_subplot(gs[:3, 0])
axv = fig.add_subplot(gs[3:, 0], sharex = axi)
axi.spines['right'].set_color('none')
axi.spines['top'].set_color('none')
axi.spines['bottom'].set_color('none')
plt.setp(axi.get_xticklabels(), visible=False)
plt.setp(axi.get_xticklines(), visible=False)
axv.spines['right'].set_color('none')
axv.spines['top'].set_color('none')
axi.spines['left'].set_smart_bounds(True)
axv.spines['left'].set_smart_bounds(True)
axv.spines['bottom'].set_smart_bounds(True)
if mode is 'vclamp':
axi.set_ylabel('Current (pA)')
axv.set_ylabel('Voltage (mV)')
else:
axv.set_ylabel('Current (pA)')
axi.set_ylabel('Voltage (mV)')
axv.set_xlabel(xlabel)
return fig, axi, axv
def plot_iv(xlabel='Voltage (mV)', ylabel='Current (pA)', zeroori=True):
fig = plt.figure()
ax = fig.add_subplot(111)
if zeroori:
ax.spines['left'].set_position('zero')
ax.spines['bottom'].set_position('zero')
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
ax.spines['left'].set_smart_bounds(True)
ax.spines['bottom'].set_smart_bounds(True)
ax.set_xlabel(xlabel)
ax.set_ylabel(ylabel)
return fig, ax
def plot_fi(ylabel='Frequency (Hz)', zeroori=True):
fig = plt.figure()
ax = fig.add_subplot(111)
ax.spines['right'].set_color('none')
ax.spines['top'].set_color('none')
if zeroori:
ax.spines['left'].set_position('zero')
ax.spines['bottom'].set_position('zero')
ax.spines['left'].set_smart_bounds(True)
ax.spines['bottom'].set_smart_bounds(True)
ax.set_xlabel('Current (pA)')
ax.set_ylabel(ylabel)
return fig, ax
def openfile_dialog():
from PyQt4 import QtGui
app = QtGui.QApplication([dir])
fname = QtGui.QFileDialog.getOpenFileName(None, "Select a file...", '.', filter="All files (*)")
return str(fname)