Wednesday, April 24, 2013

Plot me some randomness


By Vasudev Ram

In this recent post about plot.ly,

plot.ly, fast plotting in the browser,

I mentioned that plotting by pasting data worked, but plotting using Python had an issue, and that they said they were fixing it.

The plot.ly people got back to me saying that the Python issue is fixed.

I tried it out again with a couple of simple plotting examples involving random numbers. They worked.

Here are the examples:

from numpy import *
from random import randint

x = range(1, 10)
y = [ random.randint(1, 10) for i in x ]
plot(x, y)

from numpy import *
from random import randint

x = range(1, 20)
y = [ random.randint(1, 10) for i in x ]
plot(x, y)

(The only difference in the above two scripts is 10 vs 20.)

You can try out that code, or your own, in plot.ly.

Go to https://plot.ly/plot.

Click on the "tab" labeled "+" near the top left of the screen, then click "Script" from the drop-down menu.

Enter your script (no need to Save) and then click Run.

If your code has no errors, your plot will appear in a new tab (not a new browser tab, but a new "tab" within the plot.ly browser tab).

The plot may take 2 to 3 seconds to appear.

plot.ly is beta software, but looks useful. They have many more complex examples in their demos.


- Vasudev Ram - Dancing Bison Enterprises


No comments: