Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Graphing in Python 3.x

In Python 2.6, I used matplotlib to make some simple graphs. However, it is incompatible with Python 3.1.

What are some alternative modules that can accomplish the same thing without being very complex?

like image 345
John Howard Avatar asked Jul 30 '10 18:07

John Howard


People also ask

Why is %Matplotlib inline?

%matplotlib inline sets the backend of matplotlib to the 'inline' backend: With this backend, the output of plotting commands is displayed inline within frontends like the Jupyter notebook, directly below the code cell that produced it. The resulting plots will then also be stored in the notebook document.


2 Answers

You say you want to create some simple graphs but haven't really said how simple or what sort of graphs you want. So long as they aren't too complex you might want to consider using the Google Chart API.

e.g. an example chart

That has some advantages: you just have to construct a URL that describes the desired chart so there shouldn't be any issues using it from Python 3.x. Of course there are disadvantages also: you need to have an internet connection when generating the chart, and you might not have the chart styles you have been using with matplotlib.

If you don't want to construct the URLs directly there is at least one Python wrapper for the charts API. It doesn't work directly on Python 3.x, but running it through 2to3 seems to convert it successfully.

like image 63
Duncan Avatar answered Sep 29 '22 07:09

Duncan


A stable version supporting Python 3 has since been released: official announcement.

like image 11
Craig McQueen Avatar answered Sep 25 '22 07:09

Craig McQueen