Skip to content

Instantly share code, notes, and snippets.

@banditkings
Created May 15, 2024 23:22
Show Gist options
  • Save banditkings/b15f31b08721163739a0fe6731561342 to your computer and use it in GitHub Desktop.
Save banditkings/b15f31b08721163739a0fe6731561342 to your computer and use it in GitHub Desktop.
Remove facet annotations from plotly
def clean_annotations(fig):
"""Removes the annoying 'Feature=' label that clutters plotly graphs when you do facet_row or facet_col"""
fig.for_each_annotation(lambda a: a.update(text=a.text.split("=")[1]))
return fig
@banditkings
Copy link
Author

also, to have a plotly chart render on github/gitlab as a png but also stay interactive when working locally:

import plotly.io as pio
pio.renderers.default = "vscode+png"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment