summaryrefslogtreecommitdiff
path: root/using-plot-interactively/script.rst
diff options
context:
space:
mode:
authorPuneeth Chaganti2010-11-17 23:24:57 +0530
committerPuneeth Chaganti2010-11-17 23:24:57 +0530
commit347866ed0d29db61ee062563b1e1616cfb85588c (patch)
treed5fe9159a195939b5979e804bad3a7f9842a679f /using-plot-interactively/script.rst
parent75034126a8c663fc03d922f41d9bf5051cc7e88d (diff)
parent66b5c35494866a8c94a3d9dce33dbc40d86542cb (diff)
downloadst-scripts-347866ed0d29db61ee062563b1e1616cfb85588c.tar.gz
st-scripts-347866ed0d29db61ee062563b1e1616cfb85588c.tar.bz2
st-scripts-347866ed0d29db61ee062563b1e1616cfb85588c.zip
Merged heads.
Diffstat (limited to 'using-plot-interactively/script.rst')
-rw-r--r--using-plot-interactively/script.rst68
1 files changed, 41 insertions, 27 deletions
diff --git a/using-plot-interactively/script.rst b/using-plot-interactively/script.rst
index 21af31b..cd2ee6a 100644
--- a/using-plot-interactively/script.rst
+++ b/using-plot-interactively/script.rst
@@ -21,11 +21,10 @@
Script
-------
-
+{{{ Show the Title Slide }}}
Hello and welcome to the tutorial on creating simple plots using
Python.This tutorial is presented by the Fossee group.
-{{{ Show the Title Slide }}}
I hope you have IPython running on your computer.
@@ -52,13 +51,11 @@ the result of this command, you see something like ::
{{{ Slide with Error written on it }}}
-
-
Then you have to install matplotlib and run this command again.
Now type in your ipython shell ::
- In[]: linpace?
+ linpace?
@@ -66,20 +63,20 @@ as the documentation says, it returns `num` evenly spaced samples,
calculated over the interval start and stop. To illustrate this, lets
do it form 1 to 100 and try 100 points. ::
- In[]: linspace(1,100,100)
+ linspace(1,100,100)
As you can see a sequence of numbers from 1 to 100 appears.
Now lets try 200 points between 0 and 1 you do this by typing ::
- In[]: linspace(0,1,200)
+ linspace(0,1,200)
0 for start , 1 for stop and 200 for no of points. In linspace
the start and stop points can be integers, decimals , or
constants. Let's try and get 100 points between -pi to pi. Type ::
- In[]: p = linspace(-pi,pi,100)
+ p = linspace(-pi,pi,100)
'pi' here is constant defined by pylab. Save this to the variable, p
@@ -87,17 +84,17 @@ constants. Let's try and get 100 points between -pi to pi. Type ::
If you now ::
- In[]: len(p)
+ len(p)
You will get the no. of points. len function gives the no of elements
of a sequence.
Let's try and plot a cosine curve between -pi and pi using these
-points. Simply type ::
+points. Simply type::
+ plot(p,cos(points))
- In[]: plot(p,cos(points))
Here cos(points) gets the cosine value at every corresponding point to
p.
@@ -106,15 +103,15 @@ p.
We can also save cos(points) to variable cosine and plot it using
plot.::
- In[]: cosine=cos(points)
+ cosine=cos(points)
- In[]: plot(p,cosine)
+ plot(p,cosine)
Now do ::
- In[]: clf()
+ clf()
this will clear the plot.
@@ -124,7 +121,7 @@ overlaid plots , we just clear it with clf(). Now lets try a sine
plot. ::
- In []: plot(p,sin(p))
+ plot(p,sin(p))
@@ -144,37 +141,57 @@ by the name sin_curve in pdf format.
-{{{ Action corelating with the words }}}
+{{{ Show how to save the file }}}
As you can see I can specify format of file from the dropdown.
-Formats like png ,eps ,pdf, ps are available.
+Formats like png ,eps ,pdf, ps are available.
-Left to the save button is the slider button to specify the margins.
+Left to the save button is the slider button to specify the margins.
-{{{ Action corelating with the words }}}
+{{{ Show how to zoom. Press zoom button and specify region to zoom }}}
Left to this is zoom button to zoom into the plot. Just specify the
region to zoom into.
+
+{{{ Press Move button and move the axes. }}}
+
The button left to it can be used to move the axes of the plot.
-{{{ Action corelating with the words }}}
+{{{ Press Back and Forward Button }}}
The next two buttons with a left and right arrow icons change the state of the
plot and take it to the previous state it was in. It more or less acts like a
back and forward button in the browser.
-{{{ Action corelating with the words }}}
+{{{ Press home button }}}
The last one is 'home' referring to the initial plot.
-{{{ Action corelating with the words}}}
-{{{ Summary Slide }}}
+Following is an exercise that you must do.
+
+%% %% Plot (sin(x)*sin(x))/x .
+ 1. Save the plot by the sinsquarebyx.pdf in pdf format.
+ 2. Zoom and find the maxima.
+
+ 3. Bring it back to initial position.
+
+
+Please, pause the video here. Do the exercise and then continue.
+
+
+
+
+
+
+
+{{{ Summary Slide }}}
+
In this tutorial we have looked at
1. Starting Ipython with pylab
@@ -190,10 +207,7 @@ In this tutorial we have looked at
5. Using the UI of plot for studying it better . Using functionalities like save , zoom and moving the plots on x and y axis
-
-
-
-{{{ Show the "sponsored by FOSSEE" slide }}}
+ {{{ Show the "sponsored by FOSSEE" slide }}}