Skip to content

Commit 767ef0c

Browse files
author
Paul Kienzle
committed
make sure residuals plot uses same xscale as data; leave more room for the residuals plot
1 parent 6e88cbb commit 767ef0c

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

sasmodels/bumps_model.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ def parameters(self):
217217
"""
218218
Return a dictionary of parameters
219219
"""
220+
# TODO: tie the background and scale to the data rather than the model
220221
pars = self.model.parameters()
221222
if self.extra_pars is not None:
222223
pars.update(self.extra_pars)
@@ -273,12 +274,12 @@ def _plot(self, view=None, backend='matplotlib'):
273274
fig = plot_theory(data, theory, resid, view, Iq_calc=Iq_calc, label=label, backend=backend)
274275
return fig
275276

276-
def plot(self, view=None):
277-
return self._plot(view=view, backend='matplotlib')
277+
# def plot(self, view=None):
278+
# return self._plot(view=view, backend='matplotlib')
278279

279-
# # Bumps doesn't yet support 2D plots with plotly.
280-
# def plotly(self, view=None):
281-
# return self._plot(view=view, backend='plotly')
280+
# Bumps doesn't yet support 2D plots with plotly.
281+
def plotly(self, view=None):
282+
return self._plot(view=view, backend='plotly')
282283

283284
def simulate_data(self, noise=None):
284285
# type: (float) -> None

sasmodels/data.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
pass
5050
# pylint: enable=unused-import
5151

52+
RESID_RATIO = 0.25
53+
"""Portion of the graph area to use for the residuals plot"""
54+
55+
5256
def load_data(filename, index=0):
5357
# type: (str, int) -> Data
5458
"""
@@ -523,7 +527,6 @@ def get_data_label(data):
523527
run = run[0]
524528
return run if run else filename if filename else title if title else "data"
525529

526-
RESID_RATIO = 0.15
527530
def _plot_result1D(
528531
data, theory, resid, view, use_data,
529532
limits=None, Iq_calc=None, label='theory',
@@ -640,6 +643,7 @@ def ytransform(x):
640643
fig.add_hline(y=1, line=dict(color='black', dash='dot'), row=2, col=1)
641644
fig.add_hline(y=-1, line=dict(color='black', dash='dot'), row=2, col=1)
642645
fig.update_yaxes(title_text='resid', type='linear', row=2, col=1)
646+
fig.update_xaxes(type=xscale, row=2, col=1)
643647
fig.update_xaxes(title_text=xlabel, row=2, col=1)
644648
else:
645649
fig.update_xaxes(title_text=xlabel, row=1, col=1)

0 commit comments

Comments
 (0)