Skip to content

An interactive charting library using Dygraphs for the Ipython Notebook

Notifications You must be signed in to change notification settings

DayStarEngineering/PyDyGraphs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NOTE: This repository is out of date and unmaintained. The current pydygraphs project is maintained here.

PyDyGraphs

Southwest Research Institute alt tag

An interactive charting library using Dygraphs for the Ipython Notebook, without the need for any remote hosting.

Intent

The Ipython Notebook is an excellent tool for interacting with python and displaying data in real time. While tools like matplotlib can generate static plots in the Ipython Notebook, interactive javascript plots are often more useful for exploring the data. This module can be readily included in an Ipython Notebook and then used to generate beautiful time series plots with Dygraphs.

Screenshots

Simple Example SinglePlot

Subplot with Range Selector RangeSelector

Pandas Dataframe Plot Dataframe

How It Works

This python module generates javascript that interacts with the Dygraphs library, and passes it to the Ipython Notebook kernel for execution.

Currently the PyDyGraphs module depends on Pandas to generate a JSON representation of the data for plotting. This required dependancy may be removed with future work. Pandas can be installed via pip.

Example

Run the included example:examples/PyDyGraphTester.ipynb, or paste this code into an Ipython Notebook to generate an interactive timeseries plot:

# Import pydygraphs and numpy
import pydygraphs
import numpy as np

# Forma figure
fig = pydygraphs.figure(width = 600, height = 400)

# Generate data for the plot
x = np.array(range(100))
y = [np.sin(np.random.rand(100)),-np.sin(np.random.rand(100))]

# Plot the data on the figure
fig.plot(x,y, color=['navy','magenta'])
fig.title("Figure 1")
fig.xlabel('Series')
fig.ylabel('Value')

# Show the figure in this cell of the notebook
fig.show()

Installation:

Simply clone this repository and include the pydygraphs.py module in your Ipython Notebooks.

Want to contribute:

Please submit a pull request!

About

An interactive charting library using Dygraphs for the Ipython Notebook

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%