Skip to content

Commit 4d5a1cc

Browse files
committed
tutorial: added example of using group parameter in hist
1 parent c87abc1 commit 4d5a1cc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

docs/tutorial.rst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,19 @@ Draw histograms with :meth:`~datascience.tables.Table.hist`:
258258
@savefig hist_overlay.png width=4in
259259
normal_data.hist(bins = range(-5, 10), overlay = True)
260260
261+
Draw grouped histograms with the ``group`` argument:
262+
263+
.. ipython:: python
264+
265+
grouped = Table().with_columns(
266+
'value', np.random.normal(size=100),
267+
'group', np.random.choice(['A', 'B'], size=100)
268+
)
269+
270+
@savefig hist_group.png width=4in
271+
grouped.hist('value', group='group')
272+
Note: group cannot be used together with bin_column, and does not support multiple histogram columns.
273+
261274
If we treat the ``normal_data`` table as a set of x-y points, we can
262275
:meth:`~datascience.tables.Table.plot` and
263276
:meth:`~datascience.tables.Table.scatter`:

0 commit comments

Comments
 (0)