Horizontal Bar Charts in Julia

How to make horizontal bar charts in Julia with Plotly.


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!