You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: notebooks/horizontal-bar-charts.md
+101-127
Original file line number
Diff line number
Diff line change
@@ -8,9 +8,19 @@ jupyter:
8
8
format_version: '1.1'
9
9
jupytext_version: 1.1.1
10
10
kernelspec:
11
-
display_name: Python 2
11
+
display_name: Python 3
12
12
language: python
13
-
name: python2
13
+
name: python3
14
+
language_info:
15
+
codemirror_mode:
16
+
name: ipython
17
+
version: 3
18
+
file_extension: .py
19
+
mimetype: text/x-python
20
+
name: python
21
+
nbconvert_exporter: python
22
+
pygments_lexer: ipython3
23
+
version: 3.6.7
14
24
plotly:
15
25
description: How to make horizontal bar charts in Python with Plotly.
16
26
display_as: basic
@@ -24,80 +34,94 @@ jupyter:
24
34
permalink: python/horizontal-bar-charts/
25
35
thumbnail: thumbnail/horizontal-bar.jpg
26
36
title: Horizontal Bar Charts | plotly
37
+
v4upgrade: true
27
38
---
28
39
29
-
#### New to Plotly?
30
-
Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloading the client and [reading the primer](https://plot.ly/python/getting-started/).
31
-
<br>You can set up Plotly to work in [online](https://plot.ly/python/getting-started/#initialization-for-online-plotting) or [offline](https://plot.ly/python/getting-started/#initialization-for-offline-plotting) mode, or in [jupyter notebooks](https://plot.ly/python/getting-started/#start-plotting-online).
32
-
<br>We also have a quick-reference [cheatsheet](https://images.plot.ly/plotly-documentation/images/python_cheat_sheet.pdf) (new!) to help you get started!
33
-
#### Version Check
34
-
Plotly's python package is updated frequently. Run `pip install plotly --upgrade` to use the latest version.
40
+
See more examples of bar charts (including vertical bar charts) and styling options [here](https://plot.ly/python/bar-charts/).
41
+
42
+
43
+
### Horizontal Bar Chart with plotly express
44
+
45
+
Plotly express functions take as argument a tidy [pandas DataFrame](https://pandas.pydata.org/pandas-docs/stable/getting_started/10min.html). For a horizontal bar char, use the `px.bar` function with `orientation='h'`.
46
+
47
+
48
+
#### Basic Horizontal Bar Chart with plotly express
When data are not available as a tidy dataframe, you can use the more generic function `go.Bar` from `plotly.graph_objects`. All the options of `go.Bar` are documented in the reference https://plot.ly/python/reference/#bar
See more examples of bar charts and styling options [here](https://plot.ly/python/bar-charts/).<br> See https://plot.ly/python/reference/#bar for more information and chart attribute options!
0 commit comments