Skip to content

Commit 6ab7df4

Browse files
authored
PR for #13: pp-plot format (#14)
* new plot settings for #13 * moves text up for #13 * ups time to 5 minutes for #13
1 parent 843d26b commit 6ab7df4

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

.github/workflows/pytest.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Install Python dependencies and run unit tests.
22
#
33
# Note: These tests should run quickly; we set a timeout to
4-
# 15 minutes to catch possible hang-ups, should they occur.
4+
# 20 minutes to catch possible hang-ups, should they occur.
55

66
name: BootstrapReport Unit Tests
77

@@ -14,7 +14,7 @@ on:
1414
jobs:
1515
build:
1616
runs-on: ${{ matrix.os }}
17-
timeout-minutes: 15
17+
timeout-minutes: 20
1818
strategy:
1919
matrix:
2020
os: [ ubuntu-latest, windows-latest, macos-latest ]

examples/examples.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ def gamma_example():
1818

1919
# Returns True if attribute exists
2020
hasattr(ex_object, "estimate")
21-
ex_object.pp_plot(outfile=False)
21+
ex_object.pp_plot(outfile = None)
2222
ex_object.get_bias_corrected_tvd(num_sets = 2, detail = False)
23-
ex_object.density_plot(outfile = False)
24-
ex_object.get_crossings(outfile = False)
23+
ex_object.density_plot(outfile = None)
24+
ex_object.get_crossings(outfile = None)
2525
ex_object.get_tv_min()
2626

2727
### Vertical-distance-minimizing normal approximation to bootstrap replicates
@@ -43,10 +43,10 @@ def normal_example():
4343

4444
# Returns True if attribute exists
4545
hasattr(ex_object, "estimate")
46-
ex_object.pp_plot(outfile=False)
46+
ex_object.pp_plot(outfile = None)
4747
ex_object.get_bias_corrected_tvd(num_sets = 2, detail = False)
48-
ex_object.density_plot(outfile = False)
49-
ex_object.get_crossings(outfile = False)
48+
ex_object.density_plot(outfile = None)
49+
ex_object.get_crossings(outfile = None)
5050

5151
### Vertical-distance-minimizing normal approximation to bootstrap replicates
5252
ex_object.get_sk_min()

src/BootstrapReport/BootstrapReport.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def left_upper_cb(x):
168168
helpers.plot_min_crossings(outfile, optimal_path, self.crossings, alpha, rep, est,
169169
1, upper_cb, lower_cb, left_upper_cb, **kwargs)
170170

171-
def pp_plot(self, confidence_band = True, alpha = 0.05, outfile=False, **kwargs):
171+
def pp_plot(self, confidence_band = True, alpha = 0.05, outfile = None, **kwargs):
172172
""" create the pp plot
173173
:param confidence_band: Boolean value of whether to include the confidence band in the plot
174174
:param outfile: location and name of file to be saved
@@ -201,25 +201,25 @@ def pp_plot(self, confidence_band = True, alpha = 0.05, outfile=False, **kwargs)
201201

202202
plt.figure(figsize=(10, 10))
203203
if confidence_band == True:
204-
plt.fill_between(dkw_xgrid, dkw_lbound, dkw_ubound, color = plt_set['bandcolor'], label = 'Confidence band', alpha = 0.25)
204+
plt.fill_between(dkw_xgrid, dkw_lbound, dkw_ubound, color = plt_set['bandcolor'], label = 'Confidence band', alpha = 0.35)
205205
plt.scatter(replicates_eval_normcdf, replicate_ecdf, s = plt_set['pointsize'],
206206
c = plt_set['pointcolor'], label='Bootstrap replicates')
207207
plt.xlabel("CDF of normal distribution")
208-
plt.ylabel("CDF of comparison distribution")
208+
plt.ylabel("CDF of bootstrap distribution")
209209
plt.legend(edgecolor = 'k', loc = 'upper left')
210210
plt.axline((0, 0), (1, 1), color="black", linestyle=(0, (5, 5)))
211-
plt.text(0.52, 0.02, plot_data, fontsize = plt_set['legend_fontsize'], \
211+
plt.text(0.52, 0.06, plot_data, fontsize = plt_set['legend_fontsize'], \
212212
verticalalignment = 'bottom', horizontalalignment='left', bbox = props)
213-
plt.ylim(-0.05, 1.05)
214-
plt.xlim(-0.05, 1.05)
213+
plt.ylim(0, 1)
214+
plt.xlim(0, 1)
215215

216-
if outfile:
216+
if not outfile == None:
217217
plt.savefig(outfile, transparent = True, dpi = plt_set['dpi'])
218218
plt.clf()
219219
mpl.rcParams.update(mpl.rcParamsDefault)
220220

221221

222-
def density_plot(self, bounds = None, bandwidth = None, outfile = False, **kwargs):
222+
def density_plot(self, bounds = None, bandwidth = None, outfile = None, **kwargs):
223223
""" creates a smoothed density plot of replicates and shows the plot or outputs the result to outfile
224224
:param bounds: a tuple or list of the bounds of the density plot | Optional
225225
:param bandwidth: the bandwidth that the replicates are evaluated at when taking the kernel density estimate | Optional
@@ -251,7 +251,7 @@ def density_plot(self, bounds = None, bandwidth = None, outfile = False, **kwarg
251251
plt.plot([self.replicates[0], self.replicates[-1]], [0.0001, 0.0001], '|k', markeredgewidth = 1, label = 'Range of bootstrap replicates')
252252
plt.legend(loc = 'best', fontsize = 'x-small', markerscale = 0.75)
253253

254-
if outfile:
254+
if not outfile == None:
255255
plt.savefig(outfile, transparent = True, dpi = plt_set['dpi'])
256256
plt.clf()
257257
mpl.rcParams.update(mpl.rcParamsDefault)

0 commit comments

Comments
 (0)