Plotly graphs written in python to be responsive in React

  • I am rendering plotly graphs written in python on the front-end in a React app.
  • The graphs are not responsive when changing screen width

Here is my config in React

export const LinePlot: FC<{
  data: Data[] | PlotlyDataModel[];
  layout?: Partial<Layout>;
}> = ({ data, layout }) => (
    data={data as Data[]}
      autosize: true,
      paper_bgcolor: "transparent",
      plot_bgcolor: "transparent",
      // responsive: true,
      displayModeBar: false,

I have tried the following solution:

Responsive fluid layout
Build responsive chart in React with Plotly

These solutions have not worked and want to know what I am missing? The graphs are fixed and maintaining the styles in Python which is desired but need to be responsive in the UI.