Skip to content

Bar Chart labels flipped when horizontal=True #14830

@ajhyndman

Description

@ajhyndman

Checklist

  • I have searched the existing issues for similar issues.
  • I added a very descriptive title to this issue.
  • I have provided sufficient information below to help reproduce this issue.

Summary

It looks like there is an oversight in the bar_chart function. When selecting horizontal mode, the X and Y labels do not flip places to align with the flipped dataset.

Reproducible Code Example

st.bar_chart(
  data=result, 
  x="GENRE", 
  x_label="movie genre",
  y="AVG",
  y_label="avarage rating",
  horizontal=True,
)

Steps To Reproduce

Render any bar_chart using both the axis label parameters and in horizontal mode.

Expected Behavior

After selecting, horizontal=True, which flips the x and y axes of the chart, I expect the x_label to be printed along the vertical axis and y_label to be printed on the horizontal axis.

Current Behavior

Instead, x_label remains printed on the horizontal axis and y_label along the vertical axis. This means that x_label and x are no longer represented on the same axis.

Is this a regression?

  • Yes, this used to work in a previous version.

Debug info

  • Streamlit version: snowflake-current
  • Python version: snowflake-current
  • Operating System: MacOS 26.4.1
  • Browser: Firefox

Additional Information

https://snowflakecomputing.atlassian.net/browse/SNOW-3373985

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature:builtin-chartsRelated to built-in chart types, e.g. `st.line_chart`status:needs-triageIssue has not been triaged by the Streamlit teamtype:bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions