Skip to content

Commit 5b06573

Browse files
committed
minor tweaks to figures
1 parent 845e28a commit 5b06573

File tree

2 files changed

+40
-36
lines changed

2 files changed

+40
-36
lines changed

docs/tutorial/closer_look_at_viz.ipynb

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"ax.set_xlabel('Percentile')\n",
9191
"ax.set_ylabel('Total Bill (USD)')\n",
9292
"ax.set_yscale('log')\n",
93-
"ax.legend(loc='upper left')\n",
93+
"ax.set_ylim(bottom=1, top=100)\n",
9494
"seaborn.despine()"
9595
]
9696
},
@@ -113,6 +113,7 @@
113113
"fig = probscale.probplot(tips['total_bill'], ax=ax, plottype='pp', datascale='log',\n",
114114
" problabel='Percentile', datalabel='Total Bill (USD)',\n",
115115
" scatter_kws=dict(marker='.', linestyle='none', label='Bill Amount'))\n",
116+
"ax.set_ylim(bottom=1, top=100)\n",
116117
"seaborn.despine()"
117118
]
118119
},
@@ -148,7 +149,7 @@
148149
"ax.set_xlabel('Normal Quantiles')\n",
149150
"ax.set_ylabel('Total Bill (USD)')\n",
150151
"ax.set_yscale('log')\n",
151-
"ax.legend(loc='upper left')\n",
152+
"ax.set_ylim(bottom=1, top=100)\n",
152153
"seaborn.despine()"
153154
]
154155
},
@@ -169,9 +170,10 @@
169170
"source": [
170171
"fig, ax = pyplot.subplots(figsize=(6, 3))\n",
171172
"fig = probscale.probplot(tips['total_bill'], ax=ax, plottype='qq', datascale='log', \n",
172-
" problabel='Normal Quantiles', datalabel='Total Bill (USD)',\n",
173+
" problabel='Standard Normal Quantiles', datalabel='Total Bill (USD)',\n",
173174
" scatter_kws=dict(marker='.', linestyle='none', label='Bill Amount'))\n",
174-
"ax.legend(loc='upper left')\n",
175+
"\n",
176+
"ax.set_ylim(bottom=1, top=100)\n",
175177
"seaborn.despine()"
176178
]
177179
},
@@ -194,15 +196,17 @@
194196
"outputs": [],
195197
"source": [
196198
"fig, (ax1, ax2) = pyplot.subplots(figsize=(6, 6), ncols=2, sharex=True)\n",
199+
"markers = dict(marker='.', linestyle='none', label='Bill Amount')\n",
197200
"\n",
198201
"fig = probscale.probplot(tips['total_bill'], ax=ax1, plottype='pp', probax='y',\n",
199-
" datascale='log', problabel='Percentile', datalabel='Total Bill (USD)',\n",
200-
" scatter_kws=dict(marker='.', linestyle='none', label='Bill Amount'))\n",
202+
" datascale='log', problabel='Percentiles',\n",
203+
" datalabel='Total Bill (USD)', scatter_kws=markers)\n",
201204
"\n",
202205
"fig = probscale.probplot(tips['total_bill'], ax=ax2, plottype='qq', probax='y',\n",
203-
" datascale='log', problabel='Normal Quantiles', datalabel='Total Bill (USD)',\n",
204-
" scatter_kws=dict(marker='.', linestyle='none', label='Bill Amount'))\n",
205-
"ax.legend(loc='upper left')\n",
206+
" datascale='log', problabel='Standard Normal Quantiles',\n",
207+
" datalabel='Total Bill (USD)', scatter_kws=markers)\n",
208+
"\n",
209+
"ax1.set_xlim(left=1, right=100)\n",
206210
"fig.tight_layout()\n",
207211
"seaborn.despine()"
208212
]
@@ -239,20 +243,16 @@
239243
" scatter_kws=dict(marker='.', linestyle='none')\n",
240244
")\n",
241245
"\n",
242-
"fig = probscale.probplot(tips['total_bill'], ax=ax1, \n",
243-
" plottype='pp',\n",
244-
" problabel='percentile', \n",
245-
" **common_opts)\n",
246+
"fig = probscale.probplot(tips['total_bill'], ax=ax1, plottype='pp',\n",
247+
" problabel='Percentiles', **common_opts)\n",
246248
"\n",
247-
"fig = probscale.probplot(tips['total_bill'], ax=ax2, \n",
248-
" plottype='qq',\n",
249-
" problabel='Normal Quantiles', \n",
250-
" **common_opts)\n",
249+
"fig = probscale.probplot(tips['total_bill'], ax=ax2, plottype='qq',\n",
250+
" problabel='Standard Normal Quantiles', **common_opts)\n",
251251
"\n",
252-
"fig = probscale.probplot(tips['total_bill'], ax=ax3, \n",
253-
" plottype='prob',\n",
254-
" problabel='Normal Probabilities', \n",
255-
" **common_opts)\n",
252+
"fig = probscale.probplot(tips['total_bill'], ax=ax3, plottype='prob',\n",
253+
" problabel='Standard Normal Probabilities', **common_opts)\n",
254+
"\n",
255+
"ax3.set_xlim(left=1, right=100)\n",
256256
"ax3.set_ylim(bottom=0.13, top=99.87)\n",
257257
"fig.tight_layout()\n",
258258
"seaborn.despine()"
@@ -291,17 +291,19 @@
291291
"alpha = stats.alpha(10)\n",
292292
"beta = stats.beta(6, 3)\n",
293293
"\n",
294-
"fig, (ax1, ax2, ax3) = pyplot.subplots(figsize=(9, 6), ncols=3, sharey=True)\n",
294+
"fig, (ax1, ax2, ax3) = pyplot.subplots(figsize=(9, 6), ncols=3, sharex=True)\n",
295295
"fig = probscale.probplot(tips['total_bill'], ax=ax1, dist=alpha, \n",
296-
" problabel='Alpha Probabilities', **common_opts)\n",
296+
" problabel='Alpha(10) Probabilities', **common_opts)\n",
297297
"\n",
298298
"fig = probscale.probplot(tips['total_bill'], ax=ax2, dist=beta, \n",
299-
" problabel='Beta Probabilities', **common_opts)\n",
299+
" problabel='Beta(6, 1) Probabilities', **common_opts)\n",
300300
"\n",
301301
"fig = probscale.probplot(tips['total_bill'], ax=ax3, dist=None,\n",
302-
" problabel='Normal Probabilities', **common_opts)\n",
302+
" problabel='Standard Normal Probabilities', **common_opts)\n",
303303
"\n",
304-
"ax3.set_ylim(bottom=0.2, top=99.8)\n",
304+
"ax3.set_xlim(left=1, right=100)\n",
305+
"for ax in [ax1, ax2, ax3]:\n",
306+
" ax.set_ylim(bottom=0.2, top=99.8)\n",
305307
"seaborn.despine()\n",
306308
"fig.tight_layout()"
307309
]
@@ -332,18 +334,17 @@
332334
"alpha = stats.alpha(10)\n",
333335
"beta = stats.beta(6, 3)\n",
334336
"\n",
335-
"fig, (ax1, ax2, ax3) = pyplot.subplots(figsize=(9, 6), ncols=3)\n",
337+
"fig, (ax1, ax2, ax3) = pyplot.subplots(figsize=(9, 6), ncols=3, sharex=True)\n",
336338
"fig = probscale.probplot(tips['total_bill'], ax=ax1, dist=alpha, \n",
337-
" problabel='Alpha Quantiles', **common_opts)\n",
339+
" problabel='Alpha(10) Quantiles', **common_opts)\n",
338340
"\n",
339341
"fig = probscale.probplot(tips['total_bill'], ax=ax2, dist=beta, \n",
340-
" problabel='Beta Quantiles', **common_opts)\n",
342+
" problabel='Beta(6, 3) Quantiles', **common_opts)\n",
341343
"\n",
342344
"fig = probscale.probplot(tips['total_bill'], ax=ax3, dist=None,\n",
343-
" problabel='Normal Quantiles', **common_opts)\n",
345+
" problabel='Standard Normal Quantiles', **common_opts)\n",
344346
"\n",
345-
"ax.legend(loc='upper left')\n",
346-
"ax.set_ylim(bottom=0.1, top=99.9)\n",
347+
"ax1.set_xlim(left=1, right=100)\n",
347348
"seaborn.despine()\n",
348349
"fig.tight_layout()"
349350
]
@@ -494,6 +495,7 @@
494495
" line_kws=dict(label='Best-fit line'))\n",
495496
"ax.legend(loc='upper left')\n",
496497
"ax.set_ylim(bottom=0.1, top=99.9)\n",
498+
"ax.set_xlim(left=1, right=100)\n",
497499
"seaborn.despine()"
498500
]
499501
},
@@ -524,6 +526,7 @@
524526
" scatter_kws={'label': 'Observations'},\n",
525527
" problabel='Probability (%)')\n",
526528
"ax.legend(loc='lower right')\n",
529+
"ax.set_ylim(bottom=-2, top=4)\n",
527530
"seaborn.despine(fig)"
528531
]
529532
},
@@ -566,7 +569,8 @@
566569
"numpy.random.seed(0)\n",
567570
"x = numpy.random.normal(size=15)\n",
568571
"\n",
569-
"fig, (ax1, ax2, ax3) = pyplot.subplots(figsize=(6, 6), nrows=3, sharex=True)\n",
572+
"fig, (ax1, ax2, ax3) = pyplot.subplots(figsize=(6, 6), nrows=3,\n",
573+
" sharey=True, sharex=True)\n",
570574
"fig = probscale.probplot(x, ax=ax1, problabel='Cunnuane (default) plotting positions',\n",
571575
" **common_opts)\n",
572576
"\n",
@@ -697,7 +701,7 @@
697701
"outputs": [],
698702
"source": [
699703
"fg = (\n",
700-
" seaborn.FacetGrid(data=tips, hue='sex', row='smoker', col='time', aspect=1.5, margin_titles=True)\n",
704+
" seaborn.FacetGrid(data=tips, hue='sex', row='smoker', col='time', margin_titles=True, size=4)\n",
701705
" .map(probscale.probplot, 'total_bill', probax='y', bestfit=True)\n",
702706
" .set_ylabels('Probability')\n",
703707
" .add_legend()\n",

docs/tutorial/getting_started.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,12 +366,12 @@
366366
"plot = (\n",
367367
" seaborn.load_dataset(\"tips\")\n",
368368
" .assign(pct=lambda df: 100 * df['tip'] / df['total_bill'])\n",
369-
" .pipe(seaborn.FacetGrid, hue='sex', col='time', row='smoker', margin_titles=True, aspect=1.25, size=4)\n",
369+
" .pipe(seaborn.FacetGrid, hue='sex', col='time', row='smoker', margin_titles=True, aspect=1., size=4)\n",
370370
" .map(probscale.probplot, 'pct', bestfit=True, scatter_kws=dict(alpha=0.75), probax='y')\n",
371371
" .add_legend()\n",
372372
" .set_ylabels('Non-Exceedance Probabilty')\n",
373373
" .set_xlabels('Tips as percent of total bill')\n",
374-
" .set(ylim=(0.5, 99.5))\n",
374+
" .set(ylim=(0.5, 99.5), xlim=(0, 100))\n",
375375
")"
376376
]
377377
}

0 commit comments

Comments
 (0)