Skip to content

Commit

Permalink
Updated Bars matplotlib notebook examples
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed Dec 11, 2018
1 parent 8fb3eed commit 39dbfaf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
7 changes: 4 additions & 3 deletions examples/gallery/demos/matplotlib/bars_economic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
"source": [
"import pandas as pd\n",
"import holoviews as hv\n",
"from holoviews import opts\n",
"\n",
"hv.extension('matplotlib')"
]
},
Expand Down Expand Up @@ -53,9 +55,8 @@
"metadata": {},
"outputs": [],
"source": [
"%%opts Bars [category_index=2 stack_index=1 group_index=0 xrotation=90 color_by=['stack']] (color=Cycle('tab20'))\n",
"%%opts Bars [legend_position='right' legend_cols=2]\n",
"macro.to.bars([ 'Year', 'Country'], 'Trade', [])"
"macro.to.bars(['Year', 'Country'], 'Trade', []).opts(\n",
" opts.Bars(aspect=3, color=hv.Cycle('tab20'), legend_position='right', fig_size=300, legend_cols=2, stacked=True, xrotation=90))"
]
}
],
Expand Down
8 changes: 4 additions & 4 deletions examples/reference/elements/matplotlib/Bars.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"``Bars`` support stacking just like the ``Area`` element as well as grouping by a second key dimension. To activate grouping and stacking set the ``group_index`` or ``stack_index`` to the dimension name or dimension index:"
"``Bars`` support stacking just like the ``Area`` element as well as grouping by a second key dimension. When declaring a second key dimension ``Bars`` will break down a secondary category (i.e.``kdims`` as a separate group, to activate stacking set the ``stacked=True`` option, "
]
},
{
Expand All @@ -80,10 +80,10 @@
"bars = hv.Bars([k+(np.random.rand()*100.,) for k in keys],\n",
" ['Index', 'Group'], 'Count')\n",
"\n",
"grouped = bars.relabel('Grouped').opts(category_index=5, color_by=['stack'], stack_index=1)\n",
"stacked = bars.relabel('Stacked').opts(stack_index=5)\n",
"grouped = bars.relabel('Grouped')\n",
"stacked = bars.relabel('Stacked')\n",
"\n",
"grouped + stacked"
"grouped + stacked.opts(stacked=True)"
]
},
{
Expand Down

0 comments on commit 39dbfaf

Please sign in to comment.