Skip to content

Commit cd51f67

Browse files
authored
Merge pull request #80 from Carifio24/initial-gaps-update
Initialize histogram viewer config with correct gaps
2 parents 26a3617 + 1482833 commit cd51f67

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

glue_plotly/viewers/histogram/viewer.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ def __init__(self, *args, **kwargs):
3636
self.state.add_callback('gap_fraction', self._gaps_changed)
3737
self._update_axes()
3838

39+
def _gap_from_state(self):
40+
return self.state.gap_fraction if self.state.gaps else 0
41+
3942
def _create_layout_config(self):
40-
config = base_layout_config(self, barmode="overlay", bargap=0,
43+
config = base_layout_config(self, barmode="overlay",
44+
bargap=self._gap_from_state(),
4145
width=1000, height=600,
4246
**self.LAYOUT_SETTINGS)
4347
x_axis = base_rectilinear_axis(self.state, 'x')
@@ -55,8 +59,7 @@ def _update_axes(self, *args):
5559
self.state.y_axislabel = 'Number'
5660

5761
def _gaps_changed(self, *args):
58-
gap = self.state.gap_fraction if self.state.gaps else 0
59-
self.figure.layout.update(bargap=gap)
62+
self.figure.layout.update(bargap=self._gap_from_state())
6063

6164
def _roi_to_subset_state(self, roi):
6265
return roi_to_subset_state(roi, x_att=self.state.x_att)

0 commit comments

Comments
 (0)