-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathplotter.py
More file actions
executable file
·60 lines (46 loc) · 1.41 KB
/
plotter.py
File metadata and controls
executable file
·60 lines (46 loc) · 1.41 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
#!/usr/bin/python
__author__="Brian Hone"
import sys, os, string
import matplotlib.pyplot as plot
import mpl_toolkits.mplot3d.axes3d as p3
import numpy as np
import gdb
from gp_data_extractor import *
class Plotter( gdb.Command ):
def __init__( self ):
super( Plotter, self ).__init__("plot", gdb.COMMAND_OBSCURE )
def invoke( self, arg, from_tty ):
args = arg.split()
data = gp_get_data( args )
fig = plot.figure()
ax = fig.add_subplot(111)
ax.grid( True )
for u in data:
if u.dtype.kind == 'c':
ax.plot( np.abs(u) )
else:
ax.plot( u )
leg = ax.legend((args),
'upper right', shadow=False)
leg.get_frame().set_alpha(0.5)
plot.show()
# end class Plotter
class PlotThreeD( gdb.Command ):
def __init__( self ):
super( PlotThreeD, self ).__init__("plot3", gdb.COMMAND_OBSCURE )
def invoke( self, arg, from_tty ):
args = arg.split()
data = gp_get_data( args )
fig = plot.figure()
ax = p3.Axes3D( fig )
ax.grid( True )
for u in data:
if u.dtype.kind == 'c':
ax.plot( list(range(len(u))), u.real, u.imag )
leg = ax.legend((args),
'upper right', shadow=False)
leg.get_frame().set_alpha(0.5)
plot.show()
# end class PlotThreeD
Plotter()
PlotThreeD()