MCPcopy Create free account
hub / github.com/SpectacularAI/sdk / plotFrame

Function plotFrame

python/cli/diagnose/sensors.py:32–84  ·  view source on GitHub ↗
(
        x,
        ys,
        title,
        style=None,
        plottype='plot',
        xLabel=None,
        yLabel=None,
        legend=None,
        ymin=None,
        ymax=None,
        xScale=None,
        yScale=None,
        equalAxis=False,
        plot=False,
        **kwargs)

Source from the content-addressed store, hash-verified

30 return groundTruths
31
32def plotFrame(
33 x,
34 ys,
35 title,
36 style=None,
37 plottype='plot',
38 xLabel=None,
39 yLabel=None,
40 legend=None,
41 ymin=None,
42 ymax=None,
43 xScale=None,
44 yScale=None,
45 equalAxis=False,
46 plot=False,
47 **kwargs):
48 import matplotlib.pyplot as plt
49 from matplotlib.ticker import ScalarFormatter
50
51 fig, ax = plt.subplots(figsize=(8, 6))
52
53 ax.set_title(title)
54 p = getattr(ax, plottype)
55
56 if ymin is not None and ymax is not None:
57 ax.set_ylim(ymin, ymax)
58
59 if style is not None:
60 p(x, ys, style, **kwargs)
61 else:
62 p(x, ys, **kwargs)
63
64 if equalAxis:
65 ax.set_aspect('equal', adjustable='datalim')
66
67 if xLabel is not None: ax.set_xlabel(xLabel)
68 if yLabel is not None: ax.set_ylabel(yLabel)
69 if xScale is not None:
70 ax.set_xscale(xScale)
71 ax.xaxis.set_major_formatter(ScalarFormatter())
72 ax.ticklabel_format(style='plain',axis='x',useOffset=False)
73 if yScale is not None:
74 ax.set_yscale(yScale)
75 ax.yaxis.set_major_formatter(ScalarFormatter())
76 ax.ticklabel_format(style='plain',axis='y',useOffset=False)
77
78 if legend is not None:
79 leg = ax.legend(legend, fontsize='large', markerscale=10)
80 for line in leg.get_lines(): line.set_linewidth(2)
81 fig.tight_layout()
82 if plot: plt.show()
83
84 return base64(fig)
85
86def plotDiscardedFrames(
87 start,

Callers 11

analyzeTimestampsMethod · 0.85
analyzeArrivalTimesMethod · 0.85
analyzeSignalUnitMethod · 0.85
analyzeVIOVelocityMethod · 0.85
analyzeVIOPositionMethod · 0.85
diagnoseCameraFunction · 0.85
diagnoseAccelerometerFunction · 0.85
diagnoseGyroscopeFunction · 0.85
diagnoseMagnetometerFunction · 0.85
diagnoseVIOFunction · 0.85

Calls 2

pFunction · 0.85
base64Function · 0.85

Tested by

no test coverage detected