Skip to content

Commit

Permalink
Merge pull request #48 from hibtc/matchFeature
Browse files Browse the repository at this point in the history
Add dynamical color change to snapshots
  • Loading branch information
eccortes95 authored Apr 25, 2020
2 parents ea0ef8e + b1e7963 commit 100ccc3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/madgui/plot/twissfigure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ select_style:
# ``matplotlib.axes.Axes.plot()``
reference_style:
linestyle: "-"
color: "black"
color: "C0"
alpha: 0.5

# Style for monitor markers:
readouts_style:
Expand Down
4 changes: 4 additions & 0 deletions src/madgui/widget/curvemanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ def data(self):
return self.curveTable.rows

def on_btn_save(self):
"""
Add a Snapshot of the current twiss figure
"""
scene = self.scene
twiss = scene.model.twiss()
data = {
Expand All @@ -75,6 +78,7 @@ def on_btn_save(self):
style = scene.config['reference_style']
scene.snapshot_num += 1
name = "snapshot {}".format(scene.snapshot_num)
style['color'] = 'C{}'.format(scene.snapshot_num)
scene.add_curve(name, data, style)
self.curveTable.edit(
self.curveTable.model().index(len(self.available)-1, 0))
Expand Down

0 comments on commit 100ccc3

Please sign in to comment.