Skip to content

Commit b942eb4

Browse files
committed
rename axtype -> plottype & otherscale -> datascale
1 parent 53f3423 commit b942eb4

File tree

4 files changed

+66
-66
lines changed

4 files changed

+66
-66
lines changed

docs/tutorial/closer_look_at_viz.ipynb

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"cell_type": "markdown",
9595
"metadata": {},
9696
"source": [
97-
"Using the `probplot` function with `axtype='pp'`, it becomes:"
97+
"Using the `probplot` function with `plottype='pp'`, it becomes:"
9898
]
9999
},
100100
{
@@ -106,8 +106,8 @@
106106
"outputs": [],
107107
"source": [
108108
"fig, ax = pyplot.subplots(figsize=(6, 3))\n",
109-
"fig = probscale.probplot(tips['total_bill'], ax=ax, axtype='pp',\n",
110-
" otherscale='log', label='Bill Amount', \n",
109+
"fig = probscale.probplot(tips['total_bill'], ax=ax, plottype='pp',\n",
110+
" datascale='log', label='Bill Amount', \n",
111111
" xlabel='Percentile', ylabel='Total Bill (USD)',\n",
112112
" scatter_kws=dict(marker='.', linestyle='none'))\n",
113113
"ax.legend()\n",
@@ -166,8 +166,8 @@
166166
"outputs": [],
167167
"source": [
168168
"fig, ax = pyplot.subplots(figsize=(6, 3))\n",
169-
"fig = probscale.probplot(tips['total_bill'], ax=ax, axtype='qq',\n",
170-
" otherscale='log', label='Bill Amount', \n",
169+
"fig = probscale.probplot(tips['total_bill'], ax=ax, plottype='qq',\n",
170+
" datascale='log', label='Bill Amount', \n",
171171
" xlabel='Normal Quantiles', ylabel='Total Bill (USD)',\n",
172172
" scatter_kws=dict(marker='.', linestyle='none'))\n",
173173
"ax.legend()\n",
@@ -194,14 +194,14 @@
194194
"source": [
195195
"fig, (ax1, ax2) = pyplot.subplots(figsize=(6, 6), ncols=2, sharex=True)\n",
196196
"\n",
197-
"fig = probscale.probplot(tips['total_bill'], ax=ax1, axtype='pp', probax='y',\n",
198-
" otherscale='log', label='Bill Amount', \n",
197+
"fig = probscale.probplot(tips['total_bill'], ax=ax1, plottype='pp', probax='y',\n",
198+
" datascale='log', label='Bill Amount', \n",
199199
" ylabel='Percentile', xlabel='Total Bill (USD)',\n",
200200
" scatter_kws=dict(marker='.', linestyle='none'))\n",
201201
"ax.legend()\n",
202202
"\n",
203-
"fig = probscale.probplot(tips['total_bill'], ax=ax2, axtype='qq', probax='y',\n",
204-
" otherscale='log', label='Bill Amount', \n",
203+
"fig = probscale.probplot(tips['total_bill'], ax=ax2, plottype='qq', probax='y',\n",
204+
" datascale='log', label='Bill Amount', \n",
205205
" ylabel='Normal Quantiles', xlabel='Total Bill (USD)',\n",
206206
" scatter_kws=dict(marker='.', linestyle='none'))\n",
207207
"ax.legend()\n",
@@ -236,24 +236,24 @@
236236
"fig, (ax1, ax2, ax3) = pyplot.subplots(figsize=(9, 6), ncols=3, sharex=True)\n",
237237
"common_opts = dict(\n",
238238
" probax='y', \n",
239-
" otherscale='log', \n",
239+
" datascale='log', \n",
240240
" label='Bill Amount', \n",
241241
" xlabel='Total Bill (USD)',\n",
242242
" scatter_kws=dict(marker='.', linestyle='none')\n",
243243
")\n",
244244
"\n",
245245
"fig = probscale.probplot(tips['total_bill'], ax=ax1, \n",
246-
" axtype='pp',\n",
246+
" plottype='pp',\n",
247247
" ylabel='percentile', \n",
248248
" **common_opts)\n",
249249
"\n",
250250
"fig = probscale.probplot(tips['total_bill'], ax=ax2, \n",
251-
" axtype='qq',\n",
251+
" plottype='qq',\n",
252252
" ylabel='Normal Quantiles', \n",
253253
" **common_opts)\n",
254254
"\n",
255255
"fig = probscale.probplot(tips['total_bill'], ax=ax3, \n",
256-
" axtype='prob',\n",
256+
" plottype='prob',\n",
257257
" ylabel='Normal Probabilities', \n",
258258
" **common_opts)\n",
259259
"ax3.set_ylim(bottom=0.13, top=99.87)\n",
@@ -285,9 +285,9 @@
285285
"outputs": [],
286286
"source": [
287287
"common_opts = dict(\n",
288-
" axtype='prob',\n",
288+
" plottype='prob',\n",
289289
" probax='y',\n",
290-
" otherscale='log',\n",
290+
" datascale='log',\n",
291291
" label='Bill Amount',\n",
292292
" xlabel='Total Bill (USD)',\n",
293293
" scatter_kws=dict(marker='+', linestyle='none', mew=1)\n",
@@ -328,9 +328,9 @@
328328
"outputs": [],
329329
"source": [
330330
"common_opts = dict(\n",
331-
" axtype='qq',\n",
331+
" plottype='qq',\n",
332332
" probax='y',\n",
333-
" otherscale='log',\n",
333+
" datascale='log',\n",
334334
" label='Bill Amount',\n",
335335
" xlabel='Total Bill (USD)',\n",
336336
" scatter_kws=dict(marker='+', linestyle='none', mew=1)\n",
@@ -387,7 +387,7 @@
387387
"ax.set_aspect('equal')\n",
388388
"\n",
389389
"common_opts = dict(\n",
390-
" axtype='qq',\n",
390+
" plottype='qq',\n",
391391
" probax='y',\n",
392392
" ylabel='Theoretical Quantiles',\n",
393393
" xlabel='Emperical Quantiles',\n",
@@ -447,7 +447,7 @@
447447
"Adding a best-fit line to a probability plot can provide insight as to whether or not a dataset can be characterized by a distribution.\n",
448448
"\n",
449449
"This is simply done with the `bestfit=True` option in `probplot`.\n",
450-
"Behind the scenes, `probplot` transforms both the x- and y-data of fed to the regression based on the plot type and scale of the data axis (controlled via `otherscale`). \n",
450+
"Behind the scenes, `probplot` transforms both the x- and y-data of fed to the regression based on the plot type and scale of the data axis (controlled via `datascale`). \n",
451451
"\n",
452452
"Visual attributes of the line can be controled with the `line_kws` parameter.\n",
453453
"If you want label the best-fit line, that is where you specify its label.\n",
@@ -464,7 +464,7 @@
464464
"outputs": [],
465465
"source": [
466466
"fig, ax = pyplot.subplots(figsize=(6, 3))\n",
467-
"fig = probscale.probplot(tips['total_bill'], ax=ax, axtype='pp', bestfit=True,\n",
467+
"fig = probscale.probplot(tips['total_bill'], ax=ax, plottype='pp', bestfit=True,\n",
468468
" label='Bill Amount', xlabel='Percentile', ylabel='Total Bill (USD)',\n",
469469
" scatter_kws=dict(marker='.', linestyle='none', alpha=0.5),\n",
470470
" line_kws=dict(label='Best-fit line', linestyle='--', linewidth=2.5))\n",
@@ -492,8 +492,8 @@
492492
"outputs": [],
493493
"source": [
494494
"fig, ax = pyplot.subplots(figsize=(4, 6))\n",
495-
"fig = probscale.probplot(tips['total_bill'], ax=ax, axtype='prob', bestfit=True, \n",
496-
" probax='y', otherscale='log',label='Bill Amount',\n",
495+
"fig = probscale.probplot(tips['total_bill'], ax=ax, plottype='prob', bestfit=True, \n",
496+
" probax='y', datascale='log',label='Bill Amount',\n",
497497
" ylabel='Probabilities', xlabel='Total Bill (USD)',\n",
498498
" scatter_kws=dict(marker='+', linestyle='none', alpha=0.75, mew=1),\n",
499499
" line_kws=dict(label='Best-fit line', linewidth=2.5, zorder=0))\n",
@@ -556,7 +556,7 @@
556556
"outputs": [],
557557
"source": [
558558
"common_opts = dict(\n",
559-
" axtype='prob',\n",
559+
" plottype='prob',\n",
560560
" probax='x',\n",
561561
" label='Bill Amount',\n",
562562
" ylabel='Data',\n",
@@ -613,7 +613,7 @@
613613
"outputs": [],
614614
"source": [
615615
"fg = seaborn.FacetGrid(data=iris, hue='species', aspect=2)\n",
616-
"fg.map(probscale.probplot, 'petal_length', axtype='qq', probax='y')\n",
616+
"fg.map(probscale.probplot, 'petal_length', plottype='qq', probax='y')\n",
617617
"fg.set_ylabels('Quantiles')"
618618
]
619619
},

docs/tutorial/getting_started.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@
297297
" new_sample,\n",
298298
" ax=ax,\n",
299299
" probax='y', # flip the plot\n",
300-
" otherscale='log', # scale of the non-probability axis\n",
300+
" datascale='log', # scale of the non-probability axis\n",
301301
" bestfit=True, # draw a best-fit line\n",
302302
" xlabel='Lognormal Values', # labels and markers...\n",
303303
" ylabel='Non-exceedance probability',\n",
@@ -337,9 +337,9 @@
337337
"source": [
338338
"fig, (ax1, ax2, ax3) = pyplot.subplots(nrows=3, figsize=(5.5, 7))\n",
339339
"\n",
340-
"probscale.probplot(sample, ax=ax1, axtype='pp', xlabel='Percentiles')\n",
341-
"probscale.probplot(sample, ax=ax2, axtype='qq', xlabel='Quantiles')\n",
342-
"probscale.probplot(sample, ax=ax3, axtype='prob', xlabel='Probabilities')\n",
340+
"probscale.probplot(sample, ax=ax1, plottype='pp', xlabel='Percentiles')\n",
341+
"probscale.probplot(sample, ax=ax2, plottype='qq', xlabel='Quantiles')\n",
342+
"probscale.probplot(sample, ax=ax3, plottype='prob', xlabel='Probabilities')\n",
343343
"\n",
344344
"ax2.set_xlim(left=-2.5, right=2.5)\n",
345345
"ax3.set_xlim(left=0.5, right=99.5)\n",
@@ -368,12 +368,12 @@
368368
"plot = (\n",
369369
" seaborn.load_dataset(\"tips\")\n",
370370
" .assign(pct=lambda df: 100 * df['tip'] / df['total_bill'])\n",
371-
" .pipe(seaborn.FacetGrid, hue='time', col='sex', row='smoker', margin_titles=True, aspect=1.75)\n",
372-
" .map(probscale.probplot, 'pct', bestfit=True, otherscale='log', scatter_kws=dict(alpha=0.75))\n",
371+
" .pipe(seaborn.FacetGrid, hue='sex', col='time', row='smoker', margin_titles=True, aspect=1.75)\n",
372+
" .map(probscale.probplot, 'pct', bestfit=True, scatter_kws=dict(alpha=0.75), probax='y')\n",
373373
" .add_legend()\n",
374-
" .set_xlabels('Non-Exceedance Probabilty')\n",
375-
" .set_ylabels('Tips as percent of total bill')\n",
376-
")"
374+
" .set_ylabels('Non-Exceedance Probabilty')\n",
375+
" .set_xlabels('Tips as percent of total bill')\n",
376+
").set(ylim=(0.5, 99.5))"
377377
]
378378
}
379379
],

probscale/tests/test_viz.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -373,40 +373,40 @@ def test_bad_postype(self):
373373
def test_probplot_prob():
374374
fig, ax = plt.subplots()
375375
data = setup_plot_data()
376-
fig = viz.probplot(data, ax=ax, xlabel='Test xlabel', otherscale='log')
376+
fig = viz.probplot(data, ax=ax, xlabel='Test xlabel', datascale='log')
377377
nt.assert_true(isinstance(fig, plt.Figure))
378378

379379

380380
@image_comparison(baseline_images=['test_probplot_qq'], extensions=['png'])
381381
def test_probplot_qq():
382382
fig, ax = plt.subplots()
383383
data = setup_plot_data()
384-
fig = viz.probplot(data, ax=ax, axtype='qq', ylabel='Test label',
385-
otherscale='log', scatter_kws=dict(color='r'))
384+
fig = viz.probplot(data, ax=ax, plottype='qq', ylabel='Test label',
385+
datascale='log', scatter_kws=dict(color='r'))
386386

387387

388388
@image_comparison(baseline_images=['test_probplot_pp'], extensions=['png'])
389389
def test_probplot_pp():
390390
fig, ax = plt.subplots()
391391
data = setup_plot_data()
392392
scatter_kws = dict(color='b', linestyle='--', markeredgecolor='g', markerfacecolor='none')
393-
fig = viz.probplot(data, ax=ax, axtype='pp', otherscale='linear',
393+
fig = viz.probplot(data, ax=ax, plottype='pp', datascale='linear',
394394
xlabel='test x', ylabel='test y', scatter_kws=scatter_kws)
395395

396396

397397
@image_comparison(baseline_images=['test_probplot_prob_bestfit'], extensions=['png'])
398398
def test_probplot_prob_bestfit():
399399
fig, ax = plt.subplots()
400400
data = setup_plot_data()
401-
fig = viz.probplot(data, ax=ax, xlabel='Test xlabel', bestfit=True, otherscale='log')
401+
fig = viz.probplot(data, ax=ax, xlabel='Test xlabel', bestfit=True, datascale='log')
402402
nt.assert_true(isinstance(fig, plt.Figure))
403403

404404

405405
@image_comparison(baseline_images=['test_probplot_qq_bestfit'], extensions=['png'])
406406
def test_probplot_qq_bestfit():
407407
fig, ax = plt.subplots()
408408
data = setup_plot_data()
409-
fig = viz.probplot(data, ax=ax, axtype='qq', bestfit=True, ylabel='Test label', otherscale='log')
409+
fig = viz.probplot(data, ax=ax, plottype='qq', bestfit=True, ylabel='Test label', datascale='log')
410410

411411

412412
@image_comparison(baseline_images=['test_probplot_pp_bestfit'], extensions=['png'])
@@ -415,7 +415,7 @@ def test_probplot_pp_bestfit():
415415
data = setup_plot_data()
416416
scatter_kws = {'marker': 's', 'color': 'red'}
417417
line_kws = {'linestyle': '--', 'linewidth': 3}
418-
fig = viz.probplot(data, ax=ax, axtype='pp', otherscale='linear',
418+
fig = viz.probplot(data, ax=ax, plottype='pp', datascale='linear',
419419
xlabel='test x', bestfit=True, ylabel='test y',
420420
scatter_kws=scatter_kws, line_kws=line_kws)
421421

@@ -424,40 +424,40 @@ def test_probplot_pp_bestfit():
424424
def test_probplot_prob_probax_y():
425425
fig, ax = plt.subplots()
426426
data = setup_plot_data()
427-
fig = viz.probplot(data, ax=ax, xlabel='Test xlabel', otherscale='log', probax='y')
427+
fig = viz.probplot(data, ax=ax, xlabel='Test xlabel', datascale='log', probax='y')
428428
nt.assert_true(isinstance(fig, plt.Figure))
429429

430430

431431
@image_comparison(baseline_images=['test_probplot_qq_probax_y'], extensions=['png'])
432432
def test_probplot_qq_probax_y():
433433
fig, ax = plt.subplots()
434434
data = setup_plot_data()
435-
fig = viz.probplot(data, ax=ax, axtype='qq', ylabel='Test label', probax='y',
436-
otherscale='log', scatter_kws=dict(color='r'))
435+
fig = viz.probplot(data, ax=ax, plottype='qq', ylabel='Test label', probax='y',
436+
datascale='log', scatter_kws=dict(color='r'))
437437

438438

439439
@image_comparison(baseline_images=['test_probplot_pp_probax_y'], extensions=['png'])
440440
def test_probplot_pp_probax_y():
441441
fig, ax = plt.subplots()
442442
data = setup_plot_data()
443443
scatter_kws = dict(color='b', linestyle='--', markeredgecolor='g', markerfacecolor='none')
444-
fig = viz.probplot(data, ax=ax, axtype='pp', otherscale='linear', probax='y',
444+
fig = viz.probplot(data, ax=ax, plottype='pp', datascale='linear', probax='y',
445445
xlabel='test x', ylabel='test y', scatter_kws=scatter_kws)
446446

447447

448448
@image_comparison(baseline_images=['test_probplot_prob_bestfit_probax_y'], extensions=['png'])
449449
def test_probplot_prob_bestfit_probax_y():
450450
fig, ax = plt.subplots()
451451
data = setup_plot_data()
452-
fig = viz.probplot(data, ax=ax, xlabel='Test xlabel', bestfit=True, otherscale='log', probax='y')
452+
fig = viz.probplot(data, ax=ax, xlabel='Test xlabel', bestfit=True, datascale='log', probax='y')
453453
nt.assert_true(isinstance(fig, plt.Figure))
454454

455455

456456
@image_comparison(baseline_images=['test_probplot_qq_bestfit_probax_y'], extensions=['png'])
457457
def test_probplot_qq_bestfit_probax_y():
458458
fig, ax = plt.subplots()
459459
data = setup_plot_data()
460-
fig = viz.probplot(data, ax=ax, axtype='qq', bestfit=True, ylabel='Test label', otherscale='log', probax='y')
460+
fig = viz.probplot(data, ax=ax, plottype='qq', bestfit=True, ylabel='Test label', datascale='log', probax='y')
461461

462462

463463
@image_comparison(baseline_images=['test_probplot_pp_bestfit_probax_y'], extensions=['png'])
@@ -466,7 +466,7 @@ def test_probplot_pp_bestfit_probax_y():
466466
data = setup_plot_data()
467467
scatter_kws = {'marker': 's', 'color': 'red'}
468468
line_kws = {'linestyle': '--', 'linewidth': 3}
469-
fig = viz.probplot(data, ax=ax, axtype='pp', otherscale='linear', probax='y',
469+
fig = viz.probplot(data, ax=ax, plottype='pp', datascale='linear', probax='y',
470470
xlabel='test x', bestfit=True, ylabel='test y',
471471
scatter_kws=scatter_kws, line_kws=line_kws)
472472

@@ -478,11 +478,11 @@ def test_probplot_beta_dist_best_fit_y():
478478
data = setup_plot_data()
479479
dist = stats.beta(3, 3)
480480
fig = viz.probplot(data, dist=dist, ax=ax1, ylabel='Beta scale',
481-
bestfit=True, otherscale='log', probax='y')
481+
bestfit=True, datascale='log', probax='y')
482482
ax1.set_ylim(bottom=0.5, top=98)
483483

484484
fig = viz.probplot(data, ax=ax2, xlabel='Default (norm)',
485-
bestfit=True, otherscale='log', probax='y')
485+
bestfit=True, datascale='log', probax='y')
486486
ax2.set_ylim(bottom=0.5, top=98)
487487

488488
nt.assert_true(isinstance(fig, plt.Figure))
@@ -495,11 +495,11 @@ def test_probplot_beta_dist_best_fit_x():
495495
data = setup_plot_data()
496496
dist = stats.beta(3, 3)
497497
fig = viz.probplot(data, dist=dist, ax=ax1, xlabel='Beta scale',
498-
bestfit=True, otherscale='log', probax='x')
498+
bestfit=True, datascale='log', probax='x')
499499
ax1.set_xlim(left=0.5, right=98)
500500

501501
fig = viz.probplot(data, ax=ax2, xlabel='Default (norm)',
502-
bestfit=True, otherscale='log', probax='x')
502+
bestfit=True, datascale='log', probax='x')
503503
ax2.set_xlim(left=0.5, right=98)
504504

505505
nt.assert_true(isinstance(fig, plt.Figure))

0 commit comments

Comments
 (0)