Skip to content

Commit

Permalink
updated tutorial to include color palette shifting
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris committed Oct 18, 2018
1 parent 8c659cc commit 938507e
Showing 1 changed file with 83 additions and 2 deletions.
85 changes: 83 additions & 2 deletions examples/Chartify Tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,82 @@
"ch.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"- Color palette objects include methods for manipulation. See the examples below:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dark2 = chartify.color_palettes['Dark2']\n",
"dark2.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"- Sort"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sorted_dark2 = dark2.sort_by_hue()\n",
"sorted_dark2.show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"- Expand"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"dark2.expand_palette(20).show()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"- Shift"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"shifted_dark2 = dark2.shift_palette('white', percent=20)\n",
"shifted_dark2.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"- Assign the shifted color palette to a chart:"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -735,7 +811,7 @@
"source": [
"ch = chartify.Chart(x_axis_type='categorical',\n",
" blank_labels=True)\n",
"ch.style.set_color_palette('categorical', 'Colorblind')\n",
"ch.style.set_color_palette('categorical', shifted_dark2)\n",
"ch.plot.bar(data_frame=grouped_bar_data,\n",
" categorical_columns=['fruit', 'country'],\n",
" numeric_column='quantity',\n",
Expand Down Expand Up @@ -787,7 +863,11 @@
"metadata": {},
"outputs": [],
"source": [
"ch = chartify.Chart(blank_labels=True)\n",
"ch = chartify.Chart(blank_labels=True, x_axis_type='categorical')\n",
"ch.plot.bar(data_frame=grouped_bar_data,\n",
" categorical_columns=['fruit', 'country'],\n",
" numeric_column='quantity',\n",
" color_column='fruit')\n",
"ch.figure"
]
},
Expand All @@ -806,6 +886,7 @@
"source": [
"ch.figure.xaxis.axis_label_text_font_size = '30pt'\n",
"ch.figure.xaxis.axis_label_text_color = 'red'\n",
"ch.figure.height = 400\n",
"ch.axes.set_xaxis_label('A large xaxis label')\n",
"ch.show()"
]
Expand Down

0 comments on commit 938507e

Please sign in to comment.