Google Charts Now Plot Functions

I didn’t get round to posting this at the time it was announced, but as I’ve got a few posts on a similar theme already (e.g. RESTful Image Generation – When Text Just Won’t Do) I think it’s worth a quick post for continuity, if nothing else: Google Charts support for TeX images and formula plotting (i.e. provide an equation and it will give you an image back of the formula plotted out); there’s also an interactive Google Charts Playground that I hadn’t seen before…

You can also add labels to images…

So for example, take this URL:

http://chart.apis.google.com/chart
?cht=lc
&chd=t:-1|15,45
&chs=250×150&chco=FF0000,000000
&chfd=0,x,0,11,0.1,sin(x)*50%2B50
&chxt=x,y
&chm=c,00A5C6,0,110,10|a,00A5C6,0,60,10

and it delivers this:

GOogle chart demo

The following is also plotted:

google chart formula plot

from this URL:

http://chart.apis.google.com/chart
?cht=lxy&chs=250×250&chd=t:0|0|0
&chxs=0,ff0000,12,0,lt|1,0000ff,10,1,lt
&chfd=0,x,0,360,1.9,sin(4*x)*40%2b50|1,y,0,360,1.9,cos(6*y)*40%2b50
&chf=c,lg,90,FFFF00,0,FF9933,1&chco=006699

On the TeX front, this URL:
http://chart.apis.google.com/chart
?cht=tx
&chl=x%20=%20%5Cfrac%7B-b%20%5Cpm%20%5Csqrt%20%7Bb%5E2-4ac%7D%7D%7B2a%7D

delivers:
google TeX chart demo

Getting the escaping can be a bit of a pain, but the interactive playground makes things slightly easier:

Google chart playground

(You still need to escape things like “+” signs, though…)

Author: Tony Hirst

I'm a Senior Lecturer at The Open University, with an interest in #opendata policy and practice, as well as general web tinkering...

3 thoughts on “Google Charts Now Plot Functions”

Comments are closed.