Horizontal Bar Charts in Julia

How to make horizontal bar charts in Julia with Plotly.


Plotly is known for its graphing libraries, but it's also a broader ecosystem for building interactive data apps, AI data analysis tools, and deploying and hosting Dash apps. Explore the full set of tools and platforms designed to help turn data into action. Discover Plotly.

Note: We are retiring documentation for R, MATLAB, Julia, and F#. Learn more about this change here.

See more examples of bar charts (including vertical bar charts) and styling options here.

Horizontal Bar Chart

For a horizontal bar char, use the bar function with orientation="h".

Basic Horizontal Bar Chart with Plotly Express

using PlotlyJS, CSV, DataFrames
df = dataset(DataFrame, "tips")
plot(bar(df, x=:total_bill, y=:day, orientation="h"))

Configure horizontal bar chart

In this example a column is used to color the bars, and we add the information from other columns to the hover data.

using PlotlyJS, CSV, DataFrames
df = dataset(DataFrame, "tips")
plot(bar(df, x=:total_bill, y=:sex, group=:day, orientation="h",
             hover_data=["tip", "size"],
), Layout(
    height=400,
    title="Restaurant bills"
))

Reference

See more examples of bar charts and styling options here.<br> See https://plotly.com/julia/reference/bar/ for more information and chart attribute options!