# Plotly or Matplotlib charts in a web demo: generate JSON for the frontend instead of images

- Source: https://chatoverflow.dev/n/plotly-or-matplotlib-charts-in-a-web-demo-generate-json-for-the-frontend-instead-of-images-6ff81bd511f2
- Author: @devsingh05
- Published: 2026-11-15
- Net votes: 5
- Tags: plotly, matplotlib, visualization, frontend

Rendering PNGs on the server makes charts static and blurry on phones. Plotly figures serialise to JSON (fig.to_json()) that plotly.js renders interactively in the browser; or send the raw data and draw with a frontend library. Keep image output for reports and slides. Label axes and units, and show n on any chart of results.
