A Google Charts API for Python, meant to be used as an alternative to matplotlib.
A Google Charts API for Python 2 and 3, meant to be used as an alternative to matplotlib. Syntax is similar to MATLAB. The goal of this project is to make an easy to use graphing utility for the most common graphical use cases.
GooPyCharts can be installed with pip using the following command:
pip install gpcharts
Alternately, you can put gpcharts.py in your working directory or library path. Then, import gpcharts to your Python code:
from gpcharts import figure
That's it. To get started, you can plot and display a simple graph with the following code:
fig1 = figure() fig1.plot([8,7,6,5,4])
This will open the chart in a Jupyter notebook if you're using one. If you aren't, it will open a webpage in your default browser with the plot.
For more examples, see testGraph.py. Examples include scatter plots, adding titles/plot labels, and datetime graphs. For simple bar and histogram examples, see testGraph_barAndHist.py. For a jupyter notebook example, see gpcharts test.ipynb. The example does not display properly in Github, but the file should work if you download it and then do "Cell->Run All."
For timeseries, use as your x-axis the following format (as a string): 'yyyy-mm-dd HH:MM:SS'. The 'HH:MM:SS' is optional, but be consistent throughout your input. GooPyCharts will take care of the rest.
Each kind of chart has a number of possible configuration options provided by the Google Chart API and GooPyCharts allows you to use any combination of them via keywork arguments. For example, to show a line chart without a legend and with straight lines between each of the po, you can write:
f1 = figure() f1.plot([1,2], legend="'none'", curveType="'straight'")
You can use these customization features to overwrite the default options within GooPyCharts. The default GooPyCharts curveType is
'function', which produces curved lines, but the example above replaces that with the Google Charts API default, which is not curved.
Please report bugs to me and I'll do my best to fix them in short order.