@@ -256,20 +256,33 @@ start date.
256
256
- A dataset on various artists throughout history that you want to
257
257
group by artistic period (for example, Renaissance, Romantic, Modern).
258
258
259
+ - A dataset containing fine-grained version numbers (e.g. ``2.3.0``,
260
+ ``2.3.1``, ``2.3.2-rc1``, ``2.4.0``) which you'd like to analyze
261
+ in coarser-grained groups (e.g. ``2.3``, ``2.4``).
262
+
259
263
Create a Bin from String Values
260
264
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
261
265
262
- To create a bin from selected category strings:
263
-
264
266
1. Drag a string field to a :guilabel:`Category` encoding channel.
265
267
266
268
#. Toggle :guilabel:`Binning` for the field to :guilabel:`On`.
267
269
268
270
#. Click :guilabel:`Add Bin`.
269
271
270
- #. In the :guilabel:`Add Bin` window, give your bin a title and
271
- select the categories to include in your bin.
272
+ #. In the :guilabel:`Add Bin` window, give your bin a title.
273
+
274
+ At this point you can either create a bin from a list of category
275
+ strings or define a regular expression to match string values.
276
+ You can use the list of category strings if you want to choose the
277
+ exact values for each bin. A regular expression is a better choice
278
+ if you want to pattern-match a larger range of potential values.
279
+
280
+ To create a bin from selected category strings:
281
+
282
+ 1. Click the :guilabel:`Select` radio button.
272
283
284
+ #. Select the categories to include in your bin.
285
+
273
286
#. Click :guilabel:`Save`. The :guilabel:`Bins` window shows the
274
287
bins you have created and how many categories belong to each
275
288
bin.
@@ -284,6 +297,47 @@ start date.
284
297
data and may not include every value that exists in the data.
285
298
You can manually add additional values to the list.
286
299
300
+ To create a bin from a regular expression:
301
+
302
+ 1. Click the :guilabel:`Regex` radio button.
303
+
304
+ #. Enter a regular expression in the :guilabel:`Insert regex` text
305
+ box.
306
+
307
+ #. Select any desired flags from the dropdown menu to the right of
308
+ the text box. You can use any combination of the four available
309
+ flags:
310
+
311
+ .. list-table::
312
+ :header-rows: 1
313
+ :widths: 20 80
314
+
315
+ * - Flag
316
+ - Description
317
+
318
+ * - ``i``
319
+ - Case insensitive search
320
+
321
+ * - ``m``
322
+ - Multiline mode
323
+
324
+ * - ``x``
325
+ - Extended mode
326
+
327
+ * - ``s``
328
+ - Single line mode
329
+
330
+ #. A sample of matching documents appears. If there are no matching
331
+ documents, you can still save the bin.
332
+
333
+ #. Click :guilabel:`Save`. The :guilabel:`Bins` window shows the
334
+ bins you have created. Bins created from a regular expression
335
+ are noted with a :guilabel:`.*` icon.
336
+
337
+ You can add another bin by clicking the :guilabel:`Add Bin` link,
338
+ or close the :guilabel:`Bins` window by clicking the :guilabel:`X`
339
+ in the upper right corner.
340
+
287
341
Edit and Remove Existing Bins
288
342
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
289
343
@@ -301,8 +355,8 @@ start date.
301
355
302
356
To remove a bin, click the :guilabel:`Trash` icon.
303
357
304
- Example
305
- ~~~~~~~
358
+ Examples
359
+ ~~~~~~~~
306
360
307
361
The following chart groups genres from the
308
362
:ref:`Movies Sample Data <sample-data>` into broader bins:
@@ -327,17 +381,34 @@ start date.
327
381
:figwidth: 700px
328
382
:alt: Chart containing binned category data
329
383
384
+ The following chart looks through the ``description`` field of the
385
+ ``sample_airbnb.listingsAndReviews`` collection for certain words
386
+ and compares the mean prices. It uses bins to group documents based
387
+ on whether the ``description`` field contains a string matching the
388
+ pattern specified by the regular expression.
389
+
390
+ .. figure:: /images/charts/nominal-binning-regex.png
391
+ :figwidth: 700px
392
+ :alt: Chart containing binned description data
393
+
330
394
Behavior
331
395
~~~~~~~~
332
396
333
- - A single category cannot belong to multiple bins.
397
+ - Values can only belong to only one category bin, but they can belong
398
+ to any number of regex bins.
334
399
335
400
- Any values shown on the chart that have not been added to any
336
401
bins are automatically added to a default bin called
337
402
:guilabel:`Other Values`.
338
403
339
- - The order in which bins appear in the :guilabel:`Bins` window
340
- does not have any effect on the chart.
404
+ - The order in which bins appear in the :guilabel:`Bins` window is
405
+ significant. Each value is rendered in the chart as part of the
406
+ highest-ranked bin it appears in.
407
+
408
+ .. note::
409
+
410
+ You can reorder your bins by dragging and dropping them in the
411
+ :guilabel:`Bins` window.
341
412
342
413
.. _charts-sort-data:
343
414
@@ -424,3 +495,4 @@ difficult to create a meaningful chart.
424
495
.. figure:: /images/charts/charts-movie-ratings-by-country-limited.png
425
496
:figwidth: 720px
426
497
:alt: Movie ratings by country limited
498
+
0 commit comments