bqplot

0.12.45 · active · verified Mon Apr 13

bqplot is a 2-D visualization system for Jupyter, based on the constructs of the Grammar of Graphics. It provides interactive plotting for Jupyter notebooks, leveraging d3.js and ipywidgets. Every component of a bqplot plot is an interactive widget, allowing seamless integration with other Jupyter interactive widgets to create integrated GUIs. It offers both a flexible object model API and a concise pyplot-like API similar to Matplotlib. The library is actively maintained with frequent patch releases, and a major version (0.13.0) is in pre-release, indicating ongoing development.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates creating a simple line chart using bqplot's pyplot API, which is similar to Matplotlib's `pyplot`. It generates random data, creates a figure, plots the data, and displays the interactive chart in a Jupyter environment.

import numpy as np
from bqplot import pyplot as plt

# Generate some data
size = 100
np.random.seed(0)
x_data = np.arange(size)
y_data = np.cumsum(np.random.randn(size) * 100.0)

# Create a figure and plot
fig = plt.figure(title="My First Plot")
line_plot = plt.plot(x_data, y_data)

# Display the plot (in a Jupyter environment, this might be implicit or use display(fig))
# For explicit display, you'd use from IPython.display import display; display(fig)
fig

view raw JSON →