I have a plotly express facet_row plot with three subplots that works nicely. I would like to add a box to all the the rows that colours a specific region of the plot and adds a text. The add_vrect should do the job, but I struggle to get it to work.
https://plotly.com/python/horizontal-vertical-shapes/ https://plotly.com/python/facet-plots/
Code that works below
import pandas as pd
import plotly.express as px
import plotly.io as pio
ftir_data_facet = pd.read_csv(r"C:\Users\mch047\Box Sync\PhD project Mikkel C\OneDrive - UiT Office 365\Mikkel_Christensen\Bioinformatics\Paper 1\Figure 2 Plate screen panel\Full_FTIR_dataset\Paper1_Figure2_FTIR_tidy_faceformat_071120.csv", sep=";")
#ftir_data_facet
figure2_facet = px.scatter(ftir_data_facet, x="Wavenumbers (1/cm)", y="Absorbance", color="Strain", facet_row="Plate")
figure2_facet.update_xaxes(title_text="Wavenumbers (1/cm)", range=[4000, 1000], showgrid=False)
fig.show()
I have tried to add:
figure2_facet.add_vrect(x0="1750", x1="1700", row=All,
annotation_text="Carbonyl region", annotation_position="top left",
fillcolor="green", opacity=0.25, line_width=0)
I get:
"AttributeError: 'Figure' object has no attribute 'add_vrect'"
Can anybody help or explain why it does not work..?