# Tag: pylab

I’ve just added a CC BY-NC-SA 3.0 license to my (one year old) presentation about scipy and numpy and imported the code and the stuff on github, so it’s easier for people to download it (and hopefully the link will not go down, after I’ll leave the EBI)

I’ll put it also here, so you can have a look.

[slideshare id=2512270&doc=pylab-091116123248-phpapp02]

You can find some slides about pylab and some code as well on this presentation.

It is very basic, quick and dirty. But maybe it’s useful to someone.

[slideshare id=2512270&doc=pylab-091116123248-phpapp02]

For the code highlights I used pygments, which rocks.

I just discovered that in using pylab you can plot an array or list of number vs the list lenght by default.

Let’s say we have a list of point like [2,2,3,4,5,5,6,10, 23,45,58,42,12]
`points = [2,2,3,4,5,5,6,10,23,45,58,42,12]`
well to plot this you just have to
`pylab.plot(points)`

and this is the results:

pylab example

The whole script in python
```import pylab points = [2,2,3,4,5,5,6,10,23,45,58,42,12] pylab.plot(points) pylab.show() ```

The last one is needed to show the window, which will happen automatically if you are running the script using ipython with the pylab option.

I just discovered by chance. I always thought that to plot you need x and y, but of course it’s possible to infer the x if you just one to plot only the points, cause each point in the list has a “Cartesian coordinates” embedded, i.e. [0,2];[1,2];[2,3];[3,4];… etc.