Skip to main content
E2B also allows you to create interactive charts with custom styling. E2B automatically detects charts when executing Python code with runCode() in JavaScript or run_code() in Python. The Python code must include Matplotlib charts. When a chart is detected, E2B sends the data of the chart back to the client. You can access the chart in the execution.results array where each item is a Result object with the chart property.
Try out AI Data Analyst - a Next.js app that uses E2B to create interactive charts.
Here’s a simple example of bar chart:
The code above will output the following:
You can send this data to your frontend to create an interactive chart with your favorite charting library.

Supported intertactive charts

The following charts are currently supported:
  • Line chart
  • Bar chart
  • Scatter plot
  • Pie chart
  • Box and whisker plot