Skip to content

Commit

Permalink
grapher: allow show_flightmode = 0,1,2
Browse files Browse the repository at this point in the history
better for publication to separate the mode legend
  • Loading branch information
tridge committed Feb 2, 2024
1 parent 7531734 commit 8500d52
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions MAVProxy/modules/lib/grapher.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ def plotit(self, x, y, fields, colors=[], title=None, interactive=True):
if self.grid:
pylab.grid()

if self.show_flightmode:
if self.show_flightmode != 0:
alpha = 0.3
xlim = self.ax1.get_xlim()
for i in range(len(self.flightmode_list)):
Expand Down Expand Up @@ -409,14 +409,14 @@ def plotit(self, x, y, fields, colors=[], title=None, interactive=True):
else:
self.fig.canvas.set_window_title(title)

if self.show_flightmode:
if self.show_flightmode != 0:
mode_patches = []
for mode in self.modes_plotted.keys():
(color, alpha) = self.modes_plotted[mode]
mode_patches.append(matplotlib.patches.Patch(color=color,
label=mode, alpha=alpha*1.5))
labels = [patch.get_label() for patch in mode_patches]
if ax1_labels != []:
if ax1_labels != [] and self.show_flightmode != 2:
patches_legend = matplotlib.pyplot.legend(mode_patches, labels, loc=self.legend_flightmode)
self.fig.gca().add_artist(patches_legend)
else:
Expand Down
2 changes: 1 addition & 1 deletion MAVProxy/tools/MAVExplorer.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def __init__(self):
MPSetting('condition', str, None, 'condition'),
MPSetting('xaxis', str, None, 'xaxis'),
MPSetting('linestyle', str, None, 'linestyle'),
MPSetting('show_flightmode', bool, True, 'show flightmode'),
MPSetting('show_flightmode', int, 1, 'show flightmode'),
MPSetting('sync_xzoom', bool, True, 'sync X-axis zoom'),
MPSetting('sync_xmap', bool, True, 'sync X-axis zoom for map'),
MPSetting('legend', str, 'upper left', 'legend position'),
Expand Down

0 comments on commit 8500d52

Please sign in to comment.