diff options
-rw-r--r-- | additional_features_of_ipython/script.rst | 28 | ||||
-rw-r--r-- | additional_features_of_ipython/slides.org | 79 | ||||
-rw-r--r-- | additional_features_of_ipython/slides.tex | 146 | ||||
-rw-r--r-- | embellishing_a_plot/script.rst | 88 | ||||
-rw-r--r-- | embellishing_a_plot/slides.org | 36 | ||||
-rw-r--r-- | embellishing_a_plot/slides.tex | 141 | ||||
-rw-r--r-- | getting_started_with_ipython/script.rst | 63 | ||||
-rw-r--r-- | getting_started_with_ipython/slides.org | 25 | ||||
-rw-r--r-- | getting_started_with_ipython/slides.tex | 178 | ||||
-rw-r--r-- | loading_data_from_files/script.rst | 19 | ||||
-rw-r--r-- | multiple_plots/script.rst | 69 | ||||
-rw-r--r-- | multiple_plots/slides.org | 46 | ||||
-rw-r--r-- | multiple_plots/slides.tex | 82 | ||||
-rw-r--r-- | saving_plots/script.rst | 28 | ||||
-rw-r--r-- | saving_plots/slides.org | 59 | ||||
-rw-r--r-- | saving_plots/slides.tex | 125 | ||||
-rw-r--r-- | using_plot_interactively/oldscript.rst | 226 | ||||
-rw-r--r-- | using_plot_interactively/script.rst | 81 | ||||
-rw-r--r-- | using_plot_interactively/slides.org | 5 | ||||
-rw-r--r-- | using_plot_interactively/slides.tex | 108 |
20 files changed, 975 insertions, 657 deletions
diff --git a/additional_features_of_ipython/script.rst b/additional_features_of_ipython/script.rst index a88ba3e..087f43f 100644 --- a/additional_features_of_ipython/script.rst +++ b/additional_features_of_ipython/script.rst @@ -34,7 +34,7 @@ Hello friends and welcome to the tutorial on "Additional Features of IPython". .. L2 -{{{ Show the slide containing the outline slide }}} +{{{ Show the slide containing the objectives }}} .. R2 @@ -81,7 +81,7 @@ xsin(x) is actually x * sin(x) plot(x, sin(x)) xlabel("x") ylabel("$f(x)$") - title("x and xsin") + title("x and xsin(x)") .. R6 @@ -123,17 +123,19 @@ The default number is 40. .. R9 -Pause here and try out the following exercise + Pause the video here, try out the following exercise and resume the video. Read through the documentation of %hist and find out how to list all the commands between 5 and 10. .. L9 +{{{ Show slide with question 1 }}} + .. L10 {{{ continue from paused state }}} - +{{{ Switch to the terminal }}} :: %hist 5 10 @@ -199,12 +201,14 @@ arguments there after are the commands to be saved in the given order. .. R16 -Pause here and try out the following exercise +Pause the video here, try out the following exercise and resume the video. Change the label on y-axis to "y" and save the lines of code accordingly. .. L16 +{{{ Show slide with question 2 }}} + .. L17 {{{ continue from paused state }}} @@ -257,10 +261,10 @@ Hence to view the plot type ``show()`` on your terminal .. R21 -Pause here and try out the following exercise + Pause the video here, try out the following exercise and resume the video. - Use %hist and %save and create a script that has show in it and run it - to produce and show the plot. + Use %hist and %save and create a script that has the function show() in it.Run the + script to produce the plot and display the same. <Pause> @@ -268,6 +272,8 @@ We first look at the history using .. L21 +{{{ Show slide with question 3 }}} + :: %hist 20 @@ -299,7 +305,7 @@ interpreter and used to run the script. .. R24 -Pause here and try out the following exercise + Pause the video here, try out the following exercise and resume the video. Run the script without using the -i option. Do you find any difference? @@ -307,6 +313,8 @@ Pause here and try out the following exercise .. L24 +{{{ Show slide with question 4 }}} + .. L25 :: @@ -327,7 +335,7 @@ This brings us to the end of the tutorial.let's revise quickly what we have lear 1. to retreive the history using =%hist= command. #. to view only a part of history by passing an argument to %hist. - #. to save the required lines of code in required order using %save. + #. to save the required lines of code in required order using %save command. #. to use %run -i command to run the saved script. .. L27 diff --git a/additional_features_of_ipython/slides.org b/additional_features_of_ipython/slides.org index 4f315fc..e899837 100644 --- a/additional_features_of_ipython/slides.org +++ b/additional_features_of_ipython/slides.org @@ -32,7 +32,7 @@ * #+begin_latex \begin{center} -\textcolor{blue}{Additional Features of \texttt{ipython}} +\textcolor{blue}{Additional Features of \texttt{ipython}} \end{center} \begin{center} \includegraphics[scale=0.25]{../images/iitb-logo.png}\\ @@ -42,82 +42,62 @@ Funded by National Mission on Education through ICT MHRD, Govt. of India \end{center} #+end_latex - * Objectives At the end of this tutorial, you will be able to, - - Retrieve the ipython history. + + - Retrieve your ipython history. - View a part of the history. - - Save (relevant) parts of the history to a file. + - Save a part of your history to a file. - Run a script from within ipython. * Question 1 - Read through the documentation of ~%hist~ and find out how to list - all the commands between 5 and 10 -* Solution 1 - #+begin_src python - In []: %hist 5 10 - #+end_src + Read through the documentation of =%hist= and find out how to + list all the commands between 5 and 10. * Question 2 Change the label on y-axis to "y" and save the lines of code accordingly -* Solution 2 - #+begin_src python - In []: ylabel("y") - In []: %save /home/fossee/example_plot.py 1 3-6 10 - #+end_src * Question 3 - Use =%hist= and =%save= and create a script that has show in it and - run it to produce and show the plot. - -* Solution 3 - #+begin_src python - In []: %hist 20 - - In []: %save /home/fossee/show_included.py 1 3-6 8 10 13 - In []: %run -i /home/fossee/show_included.py - #+end_src + Use =%hist= and =%save= and create a script that has the function show() + in it.Run the script to produce the plot and display the same. + * Question 4 Run the script without using the -i option. Do you find any difference? * Solution 4 We see that it raises ~NameError~ saying the name ~linspace~ is not found. - * Summary In this tutorial, we have learnt to – - - Retrieve history using =%hist= command. - - View only a part of history by passing an argument to =%hist=. - - Sav the required lines of code in the required order using =%save=. - - Use =%run -i= command to run the saved script. - + - Retrieve the history using =%hist= command. + - View only a part of history by passing an argument to %hist. + - Save the required lines of code in required order using %save command. + - Use %run -i command to run the saved script. * Evaluation - 1. How do you retrieve the recent 5 commands - - - ``%hist`` - - ``%hist -5`` - - ``%hist 5`` - - ``%hist 5-10`` + 1. How do you retrieve the recent 5 commands + + - ``%hist`` + - ``%hist -5`` + - ``%hist 5`` + - ``%hist 5-10`` 2. How do you save the lines 2 3 4 5 7 9 10 11 - - ``%save filepath 2-5 7 9-11`` - - ``%save filepath 2-11`` - - ``%save filepath`` - - ``%save 2-5 7 9 10 11`` + - ``%save filepath 2-5 7 9-11`` + - ``%save filepath 2-11`` + - ``%save filepath`` + - ``%save 2-5 7 9 10 11`` 3. What will the command ``%hist 5 10`` display. - - The recently typed commands from 5 to 10 inclusive of - the history command - - The recently typed commands from 5 to 10 excluding - the history command - + - The recently typed commands from 5 to 10 inclusive of + the history command + - The recently typed commands from 5 to 10 excluding + the history command * Solutions 1. %hist 5 - + 2. %save filepath 2-5 7 9-11 3. %hist 5 10 - * Acknowledgement #+begin_latex \begin{block}{} @@ -134,6 +114,3 @@ MHRD, Govt. of India #+end_latex - - - diff --git a/additional_features_of_ipython/slides.tex b/additional_features_of_ipython/slides.tex index b21fa3e..cfd731c 100644 --- a/additional_features_of_ipython/slides.tex +++ b/additional_features_of_ipython/slides.tex @@ -1,6 +1,6 @@ -% Created 2010-10-10 Sun 17:30 +% Created 2011-05-03 Tue 12:39 \documentclass[presentation]{beamer} -\usepackage[latin1]{inputenc} +\usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{fixltx2e} \usepackage{graphicx} @@ -23,14 +23,13 @@ commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, showstringspaces=false, keywordstyle=\color{blue}\bfseries} \providecommand{\alert}[1]{\textbf{#1}} -\title{Additional Features of \texttt{ipython}} +\title{} \author{FOSSEE} \date{} \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} \begin{document} -\maketitle @@ -42,31 +41,38 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \begin{frame} -\frametitle{Outline} -\label{sec-1} -\begin{itemize} -\item Retrieving ipython history -\item Viewing a part of the history -\item Saving (relevant) parts of the history to a file -\item Running a script from within ipython -\end{itemize} +\begin{center} +\textcolor{blue}{Additional Features of \texttt{ipython}} +\end{center} +\begin{center} +\includegraphics[scale=0.25]{../images/iitb-logo.png}\\ +Developed by FOSSEE Team, IIT-Bombay. \\ +Funded by National Mission on Education through ICT + +MHRD, Govt. of India +\end{center} \end{frame} \begin{frame} -\frametitle{Question 1} +\frametitle{Objectives} \label{sec-2} - Read through the documentation of \texttt{\%hist} and find out how to list - all the commands between 5 and 10 + At the end of this tutorial, you will be able to, + + +\begin{itemize} +\item Retrieve your ipython history. +\item View a part of the history. +\item Save a part of your history to a file. +\item Run a script from within ipython. +\end{itemize} \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 1} +\begin{frame} +\frametitle{Question 1} \label{sec-3} -\lstset{language=Python} -\begin{lstlisting} -In []: %hist 5 10 -\end{lstlisting} + Read through the documentation of \texttt{\%hist} and find out how to + list all the commands between 5 and 10. \end{frame} \begin{frame} \frametitle{Question 2} @@ -75,75 +81,95 @@ In []: %hist 5 10 Change the label on y-axis to ``y'' and save the lines of code accordingly \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 2} +\begin{frame} +\frametitle{Question 3} \label{sec-5} -\lstset{language=Python} -\begin{lstlisting} -In []: ylabel("y") -In []: %save /home/fossee/example_plot.py 1 3-6 10 -\end{lstlisting} + Use \texttt{\%hist} and \texttt{\%save} and create a script that has the function show() + in it.Run the script to produce the plot and display the same. \end{frame} \begin{frame} -\frametitle{Question 3} +\frametitle{Question 4} \label{sec-6} - Use \texttt{\%hist} and \texttt{\%save} and create a script that has show in it and - run it to produce and show the plot. + Run the script without using the -i option. Do you find any + difference? \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 3} +\begin{frame} +\frametitle{Solution 4} \label{sec-7} -\lstset{language=Python} -\begin{lstlisting} -In []: %hist 20 - -In []: %save /home/fossee/show_included.py 1 3-6 8 10 13 -In []: %run -i /home/fossee/show_included.py -\end{lstlisting} + We see that it raises \verb~NameError~ saying the name \verb~linspace~ is not + found. \end{frame} \begin{frame} -\frametitle{Question 4} +\frametitle{Summary} \label{sec-8} - Run the script without using the -i option. Do you find any - difference? + In this tutorial, we have learnt to – + +\begin{itemize} +\item Retrieve the history using \texttt{\%hist} command. +\item View only a part of history by passing an argument to \%hist. +\item Save the required lines of code in required order using \%save command. +\item Use \%run -i command to run the saved script. +\end{itemize} \end{frame} \begin{frame} -\frametitle{Solution 4} +\frametitle{Evaluation} \label{sec-9} - We see that it raises \texttt{NameError} saying the name \texttt{linspace} is not - found. + +\begin{enumerate} +\item How do you retrieve the recent 5 commands +\begin{itemize} +\item ``\%hist`` +\item ``\%hist -5`` +\item ``\%hist 5`` +\item ``\%hist 5-10`` +\end{itemize} +\item How do you save the lines 2 3 4 5 7 9 10 11 +\begin{itemize} +\item ``\%save filepath 2-5 7 9-11`` +\item ``\%save filepath 2-11`` +\item ``\%save filepath`` +\item ``\%save 2-5 7 9 10 11`` +\end{itemize} +\item What will the command ``\%hist 5 10`` display. +\begin{itemize} +\item The recently typed commands from 5 to 10 inclusive of + the history command +\item The recently typed commands from 5 to 10 excluding + the history command +\end{itemize} +\end{enumerate} \end{frame} \begin{frame} -\frametitle{Summary} +\frametitle{Solutions} \label{sec-10} -\begin{itemize} -\item Retreiving history using \texttt{\%hist} command -\item Vieweing only a part of history by passing an argument to \%hist -\item Saving the required lines of code in required order using \%save -\item Using \%run -i command to run the saved script -\end{itemize} + +\begin{enumerate} +\item \%hist 5 +\item \%save filepath 2-5 7 9-11 +\item \%hist 5 10 +\end{enumerate} \end{frame} \begin{frame} -\frametitle{Thank you!} +\frametitle{Acknowledgement} \label{sec-11} \begin{block}{} \begin{center} - This spoken tutorial has been produced by the - \textcolor{blue}{FOSSEE} team, which is funded by the + \textcolor{blue}{\Large THANK YOU!} \end{center} + \end{block} +\begin{block}{} \begin{center} - \textcolor{blue}{National Mission on Education through \\ - Information \& Communication Technology \\ - MHRD, Govt. of India}. + For more Information, visit our website\\ + \url{http://fossee.in/} \end{center} \end{block} \end{frame} -\end{document} +\end{document}
\ No newline at end of file diff --git a/embellishing_a_plot/script.rst b/embellishing_a_plot/script.rst index b5a1cfb..29eb0eb 100644 --- a/embellishing_a_plot/script.rst +++ b/embellishing_a_plot/script.rst @@ -33,7 +33,6 @@ team along with the logo of MHRD }}} Welcome to the tutorial on Embellishing Plots. - .. L2 {{{ Show the slide containing objectives }}} @@ -51,6 +50,7 @@ At the end of this tutorial, you will be able to, .. R3 Let us start ipython with pylab loaded, open the terminal and type + :: ipython -pylab @@ -116,7 +116,7 @@ A plot with line thickness 2 is produced. Pause the video and do this exercise. Resume the video, after the exercise is solved. -Plot sin(x) in blue colour and with linewidth as 3. +Plot sin(x) in blue colour alongwith linewidth as 3. .. L9 @@ -179,7 +179,6 @@ documentation of plot. {{{ Show the options available for line style and colors }}} - .. L15 {{{Show slide containing question 2}}} @@ -188,13 +187,11 @@ documentation of plot. Pause the video and do this exercise. Resume the video, after the exercise is solved. -1. Plot the sine curve with green filled circles. -2. Plot the curve of x vs tan(x) in red dashed line and linewidth 3. - + Plot the sine curve with green filled circles. .. R16 -For question 1, use a combination of linestyle and colour. +We use a combination of linestyle and colour. .. L16 @@ -206,9 +203,22 @@ For question 1, use a combination of linestyle and colour. .. L17 -For question 2, use a combination of linewidth argument and linestyle. +{{{Show slide containing question 3}}} + +.. R17 + +Pause the video here, try out the following exercise and resume the video. + +Plot the curve of x vs tan(x) in red dashed line and linewidth 3. + +.. R18 + +Here we shall use a combination of linewidth argument and linestyle. + +.. L18 {{{ Switch to terminal and type the following commands }}} + :: clf() @@ -219,6 +229,8 @@ For question 2, use a combination of linewidth argument and linestyle. Now that we know how to produce a bare minimum plot with colour, style and thickness of our interest, we shall look at further decorating the plot. +.. L19 + .. R20 Let us start with a plot for the function -x^2 + 4x - 5. @@ -275,11 +287,9 @@ As we can see, the polynomial is now formatted. {{{Show slide containing question 4}}} -Pause the video and do this exercise. Resume the video, after the exercise is solved. - .. R24 -{{{ Let us try out the following exercise }}} +Pause the video here, try out the following exercise and resume the video. Change the title of the figure such that the whole title is formatted in LaTeX style. @@ -308,8 +318,6 @@ and y axes. we shall label x-axis to "x" and y-axis to "f(x)". .. L27 - - .. R27 As you can see, ``xlabel`` and 'ylabel' command takes a string as an argument. @@ -317,13 +325,10 @@ xlabel sets the label to x-axis as 'x' and ylabel sets the name to the y-axis as .. R28 - - .. L28 :: - {{{ Show the plot window and point to xlabel and ylabel and switch back to the terminal }}} .. L29 @@ -332,26 +337,22 @@ xlabel sets the label to x-axis as 'x' and ylabel sets the name to the y-axis as .. R29 -Pause the video and do this exercise. Resume the video, after the exercise is solved. +Pause the video here, try out the following exercise and resume the video. Set the x and y labels as "x" and "f(x)" in LaTeX style. -{{{ Pause for some time and then Show slide with answer 5 }}} - Since we need LaTeX style formatting, all we have to do is enclose the string in between two $. .. L30 - - -.. R30 - -{{{ Read out the commands on the slides }}} +:: xlabel("$x$") ylabel("$f(x)$") +.. R30 + .. L31 {{{ Show the plot window with clean labels }}} @@ -396,8 +397,8 @@ What happens to the first annotation ? .. L34 -{{{Show slide with answer 6}}} {{{ Switch to the terminal and type the command }}} + :: annotate("root", xy=(-4,0)) @@ -445,58 +446,55 @@ Similarly set the limits of y-axis appropriately. ylim(-15, 2) - .. L38 -{{{ Pause here and try out the following exercises }}} +{{{Show slide containing question 7 }}} -Pause the video and do this exercise. Resume the video, after the exercise is solved. +.. R38 -{{{Show slide containing question 7 and read it out }}} +Pause the video and do this exercise. Resume the video, after the exercise is solved. Set the limits of axes such that the area of interest is the rectangle (-1, -15) and (3, 0) -{{{ continue from paused state }}} - -.. R38 +.. R39 As we can see, the lower and upper limits of x-axis in the question are -1 and 3 respectively. The lower and upper limits of y-axis are -15 and 0 respectively. .. L39 -{{{Show slide with answer 7}}} - :: xlim(-1, 3) ylim(-15, 0) -.. R39 +.. R40 This gives us the required rectangle. .. L40 +.. L41 + {{{ Show summary slide }}} -.. R40 +.. R41 -Lets Summarize. In this spoken tutorial we have learnt, +Let's quickly revise what we have learnt today. In this spoken tutorial we have learnt, 1. to Modify the attributes of plot like color, line width, line style by passing additional arguments. #. to add title to a plot using 'title' command. #. to incorporate LaTeX style formatting by adding a ``$`` sign before and after the part of the -string. + string. #. to label x and y axes using xlabel() and ylabel() commands. #. to add annotations to a plot using annotate() command. #. to get and set the limits of axes using xlim() and ylim() commands. -.. L41 +.. L42 {{{ Show the 'self assesment questions' slide}}} -.. R41 +.. R42 Here are some self assessment questions for you to solve. @@ -511,12 +509,11 @@ Here are some self assessment questions for you to solve. 3. How do you set the title as x^2-5x+6 in LaTex style formatting. - -.. L42 +.. L43 {{{ solutions for the self assessment questions }}} -.. R42 +.. R43 And the answers, @@ -530,16 +527,17 @@ the ``linspace`` and ``plot`` command as, 2. No. We do not have an option to modify the alignment of text in the command ``ylabel``. 3. To set the title in LaTex style formatting,we write the equation between two dollar signs as, + :: title("$x^2-5x+6$") -.. L43 +.. L44 {{{ a thank you slide }}} -.. R43 +.. R44 Hope you have enjoyed and found it useful. Thankyou! diff --git a/embellishing_a_plot/slides.org b/embellishing_a_plot/slides.org index ab3342e..cbf5e01 100644 --- a/embellishing_a_plot/slides.org +++ b/embellishing_a_plot/slides.org @@ -50,55 +50,22 @@ MHRD, Govt. of India - Add annotations to the plot. - Set and Get the limits of axes. * Question 1 - Plot sin(x) in blue colour and with linewidth as 3 -* Solution 1 - #+begin_src python - In []: clf() - In []: plot(x, sin(x), 'b', linewidth=3) - #+end_src + Plot sin(x) in blue colour alongwith linewidth as 3 * Question 2 Plot the sine curve with green filled circles. -* Solution 2 - #+begin_src python - In []: clf() - In []: plot(x, cos(x), 'go') - #+end_src * Question 3 Plot the curve of x vs tan(x) in red dashed line and linewidth 3 -* Solution 3 - #+begin_src python - In []: clf() - In []: plot(x, cos(x), 'r--') - #+end_src * Question 4 Change the title of the figure such that the whole title is formatted in LaTex style -* Solution 4 - #+begin_src python - In []: title("$Parabolic function -x^2+4x-5$") - #+end_src * Question 5 Set the x and y labels as "x" and "f(x)" in LaTex style. -* Solution 5 - #+begin_src python - In []: xlabel("$x$") - In []: yalbel("$f(x)$") - #+end_src * Question 6 Make an annotation called "root" at the point (-4, 0). What happens to the first annotation? -* Solution 6 - #+begin_src python - In []: annotate("root", xy=(-4,0)) - #+end_src * Question 7 Set the limits of axes such that the area of interest is the rectangle (-1, -15) and (3, 0) -* Solution 7 - #+begin_src python - In []: xlim(-1, 3) - In []: ylim(-15, 0) - #+end_src * Summary In this tutorial,we have learnt to- + Modify the attributes of plot by passing additional arguments @@ -124,3 +91,4 @@ MHRD, Govt. of India #+end_latex + diff --git a/embellishing_a_plot/slides.tex b/embellishing_a_plot/slides.tex index e71645b..8c82d1c 100644 --- a/embellishing_a_plot/slides.tex +++ b/embellishing_a_plot/slides.tex @@ -1,4 +1,4 @@ -% Created 2010-12-18 Sat 12:25 +% Created 2011-05-03 Tue 14:38 \documentclass[presentation]{beamer} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} @@ -8,7 +8,6 @@ \usepackage{float} \usepackage{wrapfig} \usepackage{soul} -\usepackage{t1enc} \usepackage{textcomp} \usepackage{marvosym} \usepackage{wasysym} @@ -24,14 +23,14 @@ commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, showstringspaces=false, keywordstyle=\color{blue}\bfseries} \providecommand{\alert}[1]{\textbf{#1}} -\title{Embellishing a Plot} +\title{} \author{FOSSEE} \date{} \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} \begin{document} -\maketitle + @@ -42,31 +41,37 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \begin{frame} -\frametitle{Outline} -\label{sec-1} -\begin{itemize} -\item Modifying the color, line style \& linewidth of a plot -\item Adding a title to the plot (with embedded \LaTeX{}) -\item Labelling the axes -\item Annotating the plot -\item Setting the limits of axes. -\end{itemize} +\begin{center} +\textcolor{blue}{Embellishing a Plot} +\end{center} +\begin{center} +\includegraphics[scale=0.25]{../images/iitb-logo.png}\\ +Developed by FOSSEE Team, IIT-Bombay. \\ +Funded by National Mission on Education through ICT + +MHRD, Govt. of India +\end{center} \end{frame} \begin{frame} -\frametitle{Question 1} +\frametitle{Objectives} \label{sec-2} - Plot sin(x) in blue colour and with linewidth as 3 + At the end of this tutorial, you will be able to, + +\begin{itemize} +\item Modify the attributes of the plot -- color, line style,linewidth. +\item Add a title to the plot with embedded \LaTeX{}. +\item Label x and y axes. +\item Add annotations to the plot. +\item Set and Get the limits of axes. +\end{itemize} \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 1} +\begin{frame} +\frametitle{Question 1} \label{sec-3} -\begin{verbatim} -In []: clf() -In []: plot(x, sin(x), 'b', linewidth=3) -\end{verbatim} + Plot sin(x) in blue colour alongwith linewidth as 3 \end{frame} \begin{frame} \frametitle{Question 2} @@ -74,119 +79,69 @@ In []: plot(x, sin(x), 'b', linewidth=3) Plot the sine curve with green filled circles. \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 2} -\label{sec-5} - -\begin{verbatim} -In []: clf() -In []: plot(x, cos(x), 'go') -\end{verbatim} -\end{frame} \begin{frame} \frametitle{Question 3} -\label{sec-6} +\label{sec-5} Plot the curve of x vs tan(x) in red dashed line and linewidth 3 \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 3} -\label{sec-7} - -\begin{verbatim} -In []: clf() -In []: plot(x, cos(x), 'r--') -\end{verbatim} -\end{frame} \begin{frame} \frametitle{Question 4} -\label{sec-8} +\label{sec-6} Change the title of the figure such that the whole title is formatted in LaTex style \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 4} -\label{sec-9} - -\begin{verbatim} -In []: title("$Parabolic function -x^2+4x-5$") -\end{verbatim} -\end{frame} \begin{frame} \frametitle{Question 5} -\label{sec-10} +\label{sec-7} Set the x and y labels as ``x'' and ``f(x)'' in LaTex style. \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 5} -\label{sec-11} - -\begin{verbatim} -In []: xlabel("$x$") -In []: yalbel("$f(x)$") -\end{verbatim} -\end{frame} \begin{frame} \frametitle{Question 6} -\label{sec-12} +\label{sec-8} Make an annotation called ``root'' at the point (-4, 0). What happens to the first annotation? \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 6} -\label{sec-13} - -\begin{verbatim} -In []: annotate("root", xy=(-4,0)) -\end{verbatim} -\end{frame} \begin{frame} \frametitle{Question 7} -\label{sec-14} +\label{sec-9} Set the limits of axes such that the area of interest is the rectangle (-1, -15) and (3, 0) \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 7} -\label{sec-15} - -\begin{verbatim} -In []: xlim(-1, 3) -In []: ylim(-15, 0) -\end{verbatim} -\end{frame} \begin{frame} \frametitle{Summary} -\label{sec-16} +\label{sec-10} + + In this tutorial,we have learnt to- \begin{itemize} -\item Modifying the attributes of plot by passing additional arguments -\item How to add title -\item How to incorporate \LaTeX{} style formatting -\item How to label x and y axes -\item How to add annotations -\item How to set the limits of axes +\item Modify the attributes of plot by passing additional arguments +\item Add title +\item Incorporate \LaTeX{} style formatting +\item Label x and y axes +\item Add annotations +\item Set the limits of axes \end{itemize} \end{frame} \begin{frame} -\frametitle{Thank you!} -\label{sec-17} +\frametitle{Acknowledgement} +\label{sec-11} \begin{block}{} \begin{center} - This spoken tutorial has been produced by the - \textcolor{blue}{FOSSEE} team, which is funded by the + \textcolor{blue}{\Large THANK YOU!} \end{center} + \end{block} +\begin{block}{} \begin{center} - \textcolor{blue}{National Mission on Education through \\ - Information \& Communication Technology \\ - MHRD, Govt. of India}. + For more Information, visit our website\\ + \url{http://fossee.in/} \end{center} \end{block} \end{frame} -\end{document} +\end{document}
\ No newline at end of file diff --git a/getting_started_with_ipython/script.rst b/getting_started_with_ipython/script.rst index b5942ca..6d2c243 100644 --- a/getting_started_with_ipython/script.rst +++ b/getting_started_with_ipython/script.rst @@ -90,6 +90,7 @@ y to say yes and quit ipython and n to say no if you dont want to quit the ipython. Press y. .. L6 + Press y and hit enter. .. R7 @@ -118,7 +119,7 @@ Notice that the output is displayed with an ``Out[1]`` indication. 1+2 - {{Point at the Out[1] prompt}} +{{Point at the Out[1] prompt}} .. R9 @@ -218,7 +219,7 @@ out all the possible completions of r. .. R16 -Now let's try out an exercise.Pause the video and solve the problem. +Now let's try out an exercise.Pause the video,solve the problem and resume the video. 1. find out the commands starting with "ab"? 2. list out the commands starting with "a"? @@ -231,8 +232,12 @@ the commands starting with a. .. L17 -(show solution on terminal/slide) +:: + + ab<tab> + a<tab> +{{{ Show slide with Solution1 and read out the same }}} .. R18 @@ -247,16 +252,15 @@ abs? and press enter :: - abs? + abs? .. L19 :: - abs(-19) - - abs(19) + abs(-19) + abs(19) .. R19 @@ -280,8 +284,9 @@ as the result. .. R21 -Now try to solve Following exercise, -%%2%% Look-up the documentation of ``round`` and see how to use it. +Pause the video here, try out the following exercise and resume the video. + +Look-up the documentation of ``round`` and see how to use it. .. L21 @@ -291,7 +296,7 @@ Now try to solve Following exercise, :: - round? + round? .. R22 @@ -313,8 +318,15 @@ The function ``round``, rounds a number to a given precision. .. R24 +Pause the video here, try out the following exercise and resume the video. Let us now try few more examples with the function round. -Check the output of +Check the output of the following commands. + +.. L24 + +{{Show slide with question 3}} + +.. L25 :: @@ -325,18 +337,10 @@ Check the output of round(2.484,1) round(2.484,2) -.. L24 - -{{Show slide with question 3}} - -.. L25 - -{{Show slide with solution 3}} +{{Show slide with solution 3 and read out the same }} .. R25 -We got 2.0, 2.5, and 2.48 as expected. - .. R26 Let's now see how to correct typing errors which we often make while @@ -369,6 +373,7 @@ complete the command of the same examples with close parenthesis and press enter. We got the expected output that is 2.0 .. L27 + {{ Point at the prompt with three dots }} :: @@ -393,7 +398,7 @@ type Ctrl-C to interrupt the command and to get back to the .. R29 -Try the following exercise +Pause the video here, try out the following exercise and resume the video. 1. type round(2.484, and press enter. and then cancel the command using Ctrl-C. @@ -403,27 +408,26 @@ Try the following exercise {{Show slide with question 4}} - .. L30 -{ show the solution on terminal and slide } +{ show the solution on terminal } :: - round(2.484 - ^C + round(2.484 + ^C - round(2.484, 2) + round(2.484, 2) .. R30 .. L31 -{{{ show the summary slide and read out the same }}} +{{{ show the summary slide }}} .. R31 -let's revise quickly what we have learnt today. +let's revise quickly what we have learnt today.In this tutorial we learnt 1. to invoke the ``ipython`` interpreter by typing ipython. #. to quit the ``ipython`` interpreter by using <ctrl>d. @@ -463,7 +467,6 @@ Here are some self assessment questions for you to solve (solution of self assessment questions on slide) - .. R33 And the answers, @@ -473,8 +476,10 @@ And the answers, 3. We use ? at the end of the function name to display its documentation. .. L34 + {{a thank you slide}} .. R34 + Hope you have enjoyed and found it useful. Thank you! diff --git a/getting_started_with_ipython/slides.org b/getting_started_with_ipython/slides.org index 3b6fd2b..a80c454 100644 --- a/getting_started_with_ipython/slides.org +++ b/getting_started_with_ipython/slides.org @@ -52,15 +52,13 @@ MHRD, Govt. of India - look-up documentation of functions. - interrupt incomplete or incorrect commands. * Question 1 - Type =ab= and hit tab to see what happens. Next, just type =a= and - hit tab to see what happens. + 1. Type =ab= and hit tab to see what happens. + 2. Next, just type =a= and hit tab to see what happens. * Solution 1 =ab= tab completes to =abs= and =a<tab>= gives us a list of all the commands starting with a. * Question 2 - Look-up the documentation of =round= and see how to use it. -* Solution 2 - =round?= + Look-up the documentation of =round= and see how to use it * Question 3 Check the output of #+begin_src python @@ -76,18 +74,10 @@ MHRD, Govt. of India * Solution 3 We get 2.0, 2.5 and 2.48, which are what we expect. * Question 4 - Try typing =round(2.484=, and hit enter. and then cancel the command - using Ctrl-C. Then, type the command, =round(2.484, 2)= and resume - the video. -* Solution 4 - #+begin_src python - round(2.484 - ^C - - round(2.484, 2) - #+end_src - - + 1. Type =round(2.484=, and hit enter and then cancel the command + using Ctrl-C. + 2. Then, type the command, =round(2.484, 2)= and resume + the video. * Summary In this tutorial, we have learnt to – - invoke the ~ipython~ interpreter by typing ipython. @@ -137,3 +127,4 @@ MHRD, Govt. of India #+end_latex + diff --git a/getting_started_with_ipython/slides.tex b/getting_started_with_ipython/slides.tex index f9be7b9..ce10206 100644 --- a/getting_started_with_ipython/slides.tex +++ b/getting_started_with_ipython/slides.tex @@ -1,6 +1,6 @@ -% Created 2010-12-18 Sat 12:23 +% Created 2011-05-04 Wed 12:02 \documentclass[presentation]{beamer} -\usepackage[latin1]{inputenc} +\usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{fixltx2e} \usepackage{graphicx} @@ -8,7 +8,6 @@ \usepackage{float} \usepackage{wrapfig} \usepackage{soul} -\usepackage{t1enc} \usepackage{textcomp} \usepackage{marvosym} \usepackage{wasysym} @@ -24,7 +23,7 @@ commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, showstringspaces=false, keywordstyle=\color{blue}\bfseries} \providecommand{\alert}[1]{\textbf{#1}} -\title{Getting Started -- \texttt{ipython}} +\title{} \author{FOSSEE} \date{} @@ -32,71 +31,73 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \begin{document} + + + + + + + + + \begin{frame} - \frametitle{} - \begin{center} - \textcolor{blue}{Getting Started -- \texttt{ipython}} - \end{center} - \begin{center} - \includegraphics[scale=0.25]{../images/iitb-logo.png}\\ - Developed by FOSSEE Team, IIT-Bombay. \\ - Funded by National Mission on Education through ICT - - MHRD, Govt. of India - \end{center} -\end{frame} +\begin{center} +\textcolor{blue}{Getting Started -- \texttt{ipython}} +\end{center} +\begin{center} +\includegraphics[scale=0.25]{../images/iitb-logo.png}\\ +Developed by FOSSEE Team, IIT-Bombay. \\ +Funded by National Mission on Education through ICT + +MHRD, Govt. of India +\end{center} +\end{frame} \begin{frame} \frametitle{Objectives} -\label{sec-1} -At the end of this tutorial, you will be able to -- +\label{sec-2} + + At the end of this tutorial, you will be able to, + \begin{itemize} -\item invoke the \texttt{ipython} interpreter -\item quit the \texttt{ipython} interpreter -\item navigate the \texttt{ipython} session history -\item use tab-completion -\item look-up documentation of functions -\item interrupt incomplete or incorrect commands +\item invoke the \verb~ipython~ interpreter. +\item quit the \verb~ipython~ interpreter. +\item navigate in the history of \verb~ipython~. +\item use tab-completion. +\item look-up documentation of functions. +\item interrupt incomplete or incorrect commands. \end{itemize} \end{frame} - \begin{frame} \frametitle{Question 1} -\label{sec-2} +\label{sec-3} + + \begin{enumerate} \item Type \texttt{ab} and hit tab to see what happens. \item Next, just type \texttt{a} and hit tab to see what happens. \end{enumerate} \end{frame} - \begin{frame} \frametitle{Solution 1} -\label{sec-3} -\begin{enumerate} -\item \texttt{ab} tab completes to \texttt{abs} -\item \texttt{a<tab>} gives us a list of all the commands starting - with a. -\end{enumerate} -\end{frame} - -\begin{frame} -\frametitle{Question 2} \label{sec-4} - Look-up the documentation of \texttt{round} and see how to use it. + \texttt{ab} tab completes to \texttt{abs} and \texttt{a<tab>} gives us a list of all the + commands starting with a. \end{frame} \begin{frame} -\frametitle{Solution 2} +\frametitle{Question 2} \label{sec-5} - \texttt{round?} + Look-up the documentation of \texttt{round} and see how to use it \end{frame} \begin{frame}[fragile] \frametitle{Question 3} \label{sec-6} Check the output of -\begin{verbatim} +\lstset{language=Python} +\begin{lstlisting} round(2.48) round(2.48, 1) round(2.48, 2) @@ -104,7 +105,7 @@ round(2.48, 2) round(2.484) round(2.484, 1) round(2.484, 2) -\end{verbatim} +\end{lstlisting} Look-up the documentation of \texttt{round} and see how to use it. \end{frame} \begin{frame} @@ -116,80 +117,69 @@ round(2.484, 2) \begin{frame} \frametitle{Question 4} \label{sec-8} + + \begin{enumerate} -\item Try typing \texttt{round(2.484}, and hit enter. and then cancel - the command using Ctrl-C. -\item Then, type the command, \texttt{round(2.484, 2)} +\item Type \texttt{round(2.484}, and hit enter and then cancel the command + using Ctrl-C. +\item Then, type the command, \texttt{round(2.484, 2)} and resume + the video. \end{enumerate} \end{frame} -\begin{frame}[fragile] -\frametitle{Solution 4} +\begin{frame} +\frametitle{Summary} \label{sec-9} -\begin{verbatim} -round(2.484 -^C + In this tutorial, we have learnt to – -round(2.484, 2) -\end{verbatim} -\end{frame} -\begin{frame} -\frametitle{Summary} -\label{sec-10} -In this tutorial, we have learnt to -- \begin{itemize} -\item invoke the IPython interpreter using \texttt{ipython} command -\item quit \texttt{ipython} using \texttt{Ctrl-D} -\item navigate the history using arrow keys -\item use tab-completion to work faster -\item look up documentation of functions using \texttt{?} -\item send keyboard interrupts using \texttt{Ctrl-C} +\item invoke the \verb~ipython~ interpreter by typing ipython. +\item quit the \verb~ipython~ interpreter by using \verb~Ctrl-d~. +\item navigate in the history of \verb~ipython~ by using the arrow keys. +\item use tab-completionto work faster. +\item see the documentation of functions using question mark. +\item interrupt using \verb~Ctrl-c~ when we make an error. \end{itemize} \end{frame} \begin{frame} \frametitle{Evaluation} -\label{sec-11} +\label{sec-10} -\begin{itemize} -\item \texttt{ipython} is a programming language similar to Python \\ - True or False\\ - \vspace*{20pt} - \item Which key combination quits \texttt{ipython}?\\ - \vspace*{10pt} - * Ctrl + C\\ - * Ctrl + D\\ - * Alt + C\\ - * Alt + D\\ -\end{itemize} -\end{frame} -\begin{frame} -\frametitle{Evaluation} -\label{sec-12} +\begin{enumerate} +\item Ipython is a programming similar to Python? + True or False +\item Which key combination quits ``ipython``? \begin{itemize} -\item Which character is used at the end of a command, in \texttt{ipython} to display the documentation\\ -\vspace*{10pt} - * \_\\ - * ?\\ - * !\\ - * \&\\ +\item Ctrl + C +\item Ctrl + D +\item Alt + C +\item Alt + D \end{itemize} +\item Which character is used at the end of a command, in Ipython to + display the documentation. +\begin{itemize} +\item under score ($_)$ +\item question mark (?) +\item exclamation mark (!) +\item ampersand (\&) +\end{itemize} +\end{enumerate} \end{frame} \begin{frame} -\frametitle{Solutions} -\label{sec-13} +\frametitle{Solution} +\label{sec-11} -\begin{itemize} + +\begin{enumerate} \item False -\vspace*{10pt} \item Ctrl + D -\vspace*{10pt} -\item ? -\end{itemize} +\item question mark (?) +\end{enumerate} \end{frame} \begin{frame} \frametitle{Acknowledgement} -\label{sec-14} +\label{sec-12} \begin{block}{} \begin{center} @@ -204,4 +194,4 @@ In this tutorial, we have learnt to -- \end{block} \end{frame} -\end{document} +\end{document}
\ No newline at end of file diff --git a/loading_data_from_files/script.rst b/loading_data_from_files/script.rst index cc2e008..029983d 100644 --- a/loading_data_from_files/script.rst +++ b/loading_data_from_files/script.rst @@ -24,23 +24,22 @@ Script ------ -{{{ Show the slide containing title }}} +{{{ Show the first slide containing title, name of the production +team along with the logo of MHRD }}} -Hello Friends. Welcome to this tutorial on loading data from files. +Hello Friends. Welcome to this tutorial on "loading data from files". -{{{ Screen shows welcome slide }}} +{{{ Show slide with objectives }}} We often require to plot points obtained from experimental -observations. In this tutorial we shall learn to read data from files -and save it into sequences that can later be used to plot. +observations. -{{{ Show the outline for this tutorial }}} +At the end of this tutorial, you will be able to, -We shall use the ``loadtxt`` command to load data from files. We will -be looking at how to read a file with multiple columns of data and -load each column of data into a sequence. + 1. Read data from files, containing a single column of data using the ``loadtxt`` command. + #. Read multiple columns of data, separated by spaces or other delimiters. -{{{ switch back to the terminal }}} +{{{ switch to the terminal }}} As usual, let us start IPython, using :: diff --git a/multiple_plots/script.rst b/multiple_plots/script.rst index b31628f..d3dcdfe 100644 --- a/multiple_plots/script.rst +++ b/multiple_plots/script.rst @@ -37,7 +37,7 @@ At the end of this tutorial, you will be able to, #. use the figure command. #. use the legend command #. switch between the plots and perform some operations on each of them like - saving the plots. + saving the plots. #. create and switch between subplots .. R3 @@ -146,8 +146,10 @@ serial number. Now we can see the legends being displayed for the respective sine and cosine plots on the plot area. +.. R11 + We have learnt quite a lot of things now, so let us take up an -exercise.Pause the video here and do the exercise. +exercise.Pause the video here,do the exercise and resume the video. Draw two plots overlaid upon each other, with the first plot being a parabola of the form y = 4(x ^ 2) and the second being a @@ -157,9 +159,8 @@ exercise.Pause the video here and do the exercise. .. L11 -{{{ pause for a while and continue from paused state }}} +{{{ Show slide with question 1 }}} -.. R11 .. R12 @@ -168,6 +169,8 @@ commands .. L12 +{{{ pause for a while and continue from paused state }}} + :: x = linspace(-5, 5, 100) @@ -266,7 +269,7 @@ the second plot. .. R20 -Let us attempt another exercise problem.Pause here and try to solve the problem +Let us attempt another exercise problem.Pause here,try to solve the problem and resume the video. Draw a line of the form y = x as one figure and another line of the form y = 2x + 3. Switch back to the first figure, annotate @@ -275,8 +278,8 @@ Let us attempt another exercise problem.Pause here and try to solve the problem .. L20 -{{{ Pause for a while and continue from the paused state }}} - +{{{ Show slide with question 2 }}} + .. R21 To solve this problem we should first create the first figure using @@ -285,6 +288,8 @@ sure all the previous plots are cleared .. L21 +{{{ Pause for a while and continue from the paused state }}} + :: clf() @@ -374,7 +379,7 @@ subplot area using the plot command. .. L26 -{{{ Switch to ipython }}} +{{{ Switch to terminal }}} :: @@ -404,60 +409,58 @@ x-axis varies from 0 to 10 and y-axis varies from 0 to 100. .. R28 -Let us try one more exercise.Please pause here. +Let us try one more exercise.Pause the video here, try out the exercise and resume the video. We know that the Pressure, Volume and Temperatures are held by - the equation PV = nRT where nR is a constant. Let us assume nR = .01 + the equation PV = nRT where nR is a constant. Let us assume nR =0.01 Joules/Kelvin and T = 200K. V can be in the range from 21cc to 100cc. Draw two different plots as subplots, one being the Pressure - versus Volume plot and the other being Pressure versus Temparature + versus Volume plot and the other being Pressure versus Temperature plot. .. L28 -.. L29 - -{{{ Pause for a while and continue }}} +{{{ Show slide with question 3 }}} .. R29 -.. R30 - To start with, we have been given the range of Volume using which we can define the variable V -.. L30 +.. L29 + +{{{ Pause for a while and continue }}} :: V = linspace(21, 100, 500) -.. R31 +.. R30 Now we can create first subplot and draw Pressure versus Volume graph using this V. We know that nRT is a constant which is equal to 2.0 since nR = 0.01 Joules/Kelvin and T = 200 Kelvin -.. L31 +.. L30 :: subplot(2, 1, 1) plot(V, 2.0/V) -.. R32 +.. R31 Now we can create the second subplot and draw the Pressure versus Temparature plot as follows -.. L32 +.. L31 :: subplot(2, 1, 2) plot(200, 2.0/V) -.. R33 +.. R32 Unfortunately we have an error now, telling x and y dimensions don't match. This is because our V contains a set of values as returned by @@ -467,28 +470,28 @@ value. So to plot this data we need to create as many points as there are in Pressure or Volume data for Temperature too, all having the same value.Hence we do this, -.. L33 +.. L32 :: T = linspace(200, 200, 500) -.. R34 +.. R33 We now have 500 values in T each with the value 200 Kelvin. Plotting this data, we get the required plot -.. L34 +.. L33 :: plot(T, 2.0/V) -.. L35 +.. L34 {{{ Show summary slide }}} -.. R35 +.. R34 This brings us to the end of another session.let's revise quickly what we have learnt today, @@ -499,11 +502,11 @@ This brings us to the end of another session.let's revise quickly what we have l of them like saving the plots. #. to create subplots and to switch between them. -.. L36 +.. L35 {{Show self assessment questions slide}} -.. R36 +.. R35 Here are some self assessment questions for you to solve @@ -515,11 +518,11 @@ Here are some self assessment questions for you to solve - subplot(numRows, numCols) - subplot(numCols, numRows) -.. L37 +.. L36 (solution of self assessment questions on slide) -.. R37 +.. R36 And the answers, @@ -528,11 +531,11 @@ And the answers, 2. The subplot command takes three arguments namely the number of rows followed by the the number of columns and the plot number.Hence the first option is correct. -.. L38 +.. L37 {{{ a thank you slide }}} -.. R38 +.. R37 Hope you have enjoyed and found it useful. Thank you! diff --git a/multiple_plots/slides.org b/multiple_plots/slides.org index 1a9aee8..1dea6b0 100644 --- a/multiple_plots/slides.org +++ b/multiple_plots/slides.org @@ -18,7 +18,7 @@ #+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, #+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries} -#+TITLE: Multiple Plots +#+TITLE: #+AUTHOR: FOSSEE #+EMAIL: #+DATE: @@ -29,8 +29,21 @@ #+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t #+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc +* +#+begin_latex +\begin{center} +\textcolor{blue}{Multiple Plots} +\end{center} +\begin{center} +\includegraphics[scale=0.25]{../images/iitb-logo.png}\\ +Developed by FOSSEE Team, IIT-Bombay. \\ +Funded by National Mission on Education through ICT + +MHRD, Govt. of India +\end{center} +#+end_latex -* Objective +* Objectives At the end of this tutorial you will be able to - draw multiple plots which are overlaid - use the figure command @@ -39,6 +52,34 @@ saving the plots. - create and switch between subplots +* Question1 + - Draw two plots overlaid upon each other, with the first plot + being a parabola of the form y = 4(x ^ 2) and the second being a + straight line of the form y = 2x + 3 in the interval -5 to 5. + - Use colors to differentiate between the plots and use legends to + indicate what each plot is doing. +* Question2 + - Draw a line of the form y = x as one figure and another line + of the form y = 2x + 3. + - Switch back to the first figure, annotate the x and y intercepts. + - Now switch to the second figure and annotate its x and y intercepts. + Save each of them. +* Question3 + - We know that the Pressure, Volume and Temperatures are held by + the equation PV = nRT where nR is a constant. Let us assume + nR=0.01 Joules/Kelvin and T = 200K. + V can be in the range from 21cc to 100cc. + - Draw two different plots as subplots, one being the Pressure + versus Volume plot and the other being Pressure versus Temperature + plot. +* Summary + In this tutorial, we have learnt to – + - draw multiple plots which are overlaid. + - use the figure command. + - use the legend command. + - switch between the plots and perform some operations on each + of them like saving the plots. + - create subplots and to switch between them. * Acknowledgement #+begin_latex \begin{block}{} @@ -56,3 +97,4 @@ #+end_latex + diff --git a/multiple_plots/slides.tex b/multiple_plots/slides.tex index 7498504..538c6c9 100644 --- a/multiple_plots/slides.tex +++ b/multiple_plots/slides.tex @@ -1,6 +1,6 @@ -% Created 2011-04-27 Wed 16:40 +% Created 2011-05-03 Tue 11:51 \documentclass[presentation]{beamer} -\usepackage[latin1]{inputenc} +\usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{fixltx2e} \usepackage{graphicx} @@ -23,14 +23,13 @@ commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, showstringspaces=false, keywordstyle=\color{blue}\bfseries} \providecommand{\alert}[1]{\textbf{#1}} -\title{Multiple Plots} +\title{} \author{FOSSEE} \date{} \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} \begin{document} -\maketitle @@ -42,8 +41,21 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \begin{frame} -\frametitle{Objective} -\label{sec-1} + +\begin{center} +\textcolor{blue}{Multiple Plots} +\end{center} +\begin{center} +\includegraphics[scale=0.25]{../images/iitb-logo.png}\\ +Developed by FOSSEE Team, IIT-Bombay. \\ +Funded by National Mission on Education through ICT + +MHRD, Govt. of India +\end{center} +\end{frame} +\begin{frame} +\frametitle{Objectives} +\label{sec-2} At the end of this tutorial you will be able to @@ -57,8 +69,64 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \end{itemize} \end{frame} \begin{frame} +\frametitle{Question1} +\label{sec-3} + + +\begin{itemize} +\item Draw two plots overlaid upon each other, with the first plot + being a parabola of the form y = 4(x \^{} 2) and the second being a + straight line of the form y = 2x + 3 in the interval -5 to 5. +\item Use colors to differentiate between the plots and use legends to + indicate what each plot is doing. +\end{itemize} +\end{frame} +\begin{frame} +\frametitle{Question2} +\label{sec-4} + + +\begin{itemize} +\item Draw a line of the form y = x as one figure and another line + of the form y = 2x + 3. +\item Switch back to the first figure, annotate the x and y intercepts. +\item Now switch to the second figure and annotate its x and y intercepts. + Save each of them. +\end{itemize} +\end{frame} +\begin{frame} +\frametitle{Question3} +\label{sec-5} + + +\begin{itemize} +\item We know that the Pressure, Volume and Temperatures are held by + the equation PV = nRT where nR is a constant. Let us assume + nR=0.01 Joules/Kelvin and T = 200K. + V can be in the range from 21cc to 100cc. +\item Draw two different plots as subplots, one being the Pressure + versus Volume plot and the other being Pressure versus Temperature + plot. +\end{itemize} +\end{frame} +\begin{frame} +\frametitle{Summary} +\label{sec-6} + + In this tutorial, we have learnt to – + +\begin{itemize} +\item draw multiple plots which are overlaid. +\item use the figure command. +\item use the legend command. +\item switch between the plots and perform some operations on each + of them like saving the plots. +\item create subplots and to switch between them. +\end{itemize} +\end{frame} +\begin{frame} \frametitle{Acknowledgement} -\label{sec-2} +\label{sec-7} \begin{block}{} \begin{center} diff --git a/saving_plots/script.rst b/saving_plots/script.rst index 7019015..c794690 100644 --- a/saving_plots/script.rst +++ b/saving_plots/script.rst @@ -23,7 +23,7 @@ .. #[Puneeth: Quickref missing.] ======= -Savefig +Script ======= .. L1 @@ -45,21 +45,21 @@ At the end of this tutorial, you will be able to, 1. Save plots using ``savefig()`` function. #. Save plots in different formats. -.. L3 - -{{{ switch to next slide, a sine wave}}} - .. R3 Start your IPython interpreter with the command ipython -pylab -.. L4 +.. L3 :: ipython -pylab +.. L4 + +{{{Switch to slide 'Creating a basic plot'}}} + .. R4 As you know, it will start your IPython interpreter with the required @@ -98,8 +98,6 @@ reports. {{{ switch to next slide, savefig() }}} -{{{ Switch the focus to IPython interpreter window }}} - .. R7 For saving the plot, we will use ``savefig()`` function.For this we shall keep the @@ -107,6 +105,8 @@ plot window open alongside the terminal. The statement is, .. L8 +{{{ Switch the focus to IPython interpreter window }}} + :: savefig('/home/fossee/sine.png') @@ -167,13 +167,11 @@ support transparency etc. .. L13 -{{{ switch to next slide, exercise 1 }}} +{{{ switch to next slide,'exercise 1' }}} .. R13 -Let us now try to save the plot in eps format. ``eps`` stands for -encapsulated post script, and it can be embedded in your latex -documents. Pause here and try to figure it out yourself. +Save the sine plot in the format EPS which can be embedded in LaTeX documents. .. L14 @@ -186,8 +184,6 @@ We still have the sine plot with us, and now let us save the plot as .. L15 -{{{ switch to next slide, solution 1 }}} - {{{ Switch focus to IPython interpreter }}} .. R15 @@ -208,8 +204,8 @@ Now let us go to ``/home/fossee`` and see the new file created. .. L17 -{{{ Highlight the file sine.eps with a single mouse click for 2 -seconds and then double click and open the file }}} +{{{ Highlight the file sine.eps for 2 seconds and + then double click and open the file }}} .. R17 diff --git a/saving_plots/slides.org b/saving_plots/slides.org index 4278516..487f7aa 100644 --- a/saving_plots/slides.org +++ b/saving_plots/slides.org @@ -18,7 +18,7 @@ #+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, #+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries} -#+TITLE: Savefig +#+TITLE: #+AUTHOR: FOSSEE #+EMAIL: info@fossee.in #+DATE: 2010-10-11 Mon @@ -29,11 +29,24 @@ #+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t #+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc -* Outline - - Saving plots. - - Plotting in different formats. - - Locating the file in the file system. +* +#+begin_latex +\begin{center} +\textcolor{blue}{Saving Plots} +\end{center} +\begin{center} +\includegraphics[scale=0.25]{../images/iitb-logo.png}\\ +Developed by FOSSEE Team, IIT-Bombay. \\ +Funded by National Mission on Education through ICT +MHRD, Govt. of India +\end{center} +#+end_latex +* Objectives + At the end of this tutorial, you will be able to, + - Save plots using ``savefig()`` function. + - Save plots in different formats. + * Creating a basic plot Plot a sine wave from -3pi to 3pi. #+begin_src python @@ -63,37 +76,33 @@ ~supports transparency~ * Exercise 1 Save the sine plot in the format EPS which can be embedded in LaTeX documents. -* Solution 1 - #+begin_src python - savefig('/home/fossee/sine.eps') - #+end_src * Exercise 2 Save the sine plot in PDF, PS and SVG formats. * Summary - You should now be able to - - Use ~savefig()~ function - - Save plots in different formats - - PDF - - PS - - PNG - - SVG - - EPS - - Locating the files in file system. - -* Thank you! + In this tutorial, we have learnt to – + - Save plots using the ``savefig()`` function. + - Save the plots in differnt formats. + - pdf + - ps + - png + - svg + - epg + - Locate files in the file system. +* Acknowledgement #+begin_latex \begin{block}{} \begin{center} - This spoken tutorial has been produced by the - \textcolor{blue}{FOSSEE} team, which is funded by the + \textcolor{blue}{\Large THANK YOU!} \end{center} + \end{block} +\begin{block}{} \begin{center} - \textcolor{blue}{National Mission on Education through \\ - Information \& Communication Technology \\ - MHRD, Govt. of India}. + For more Information, visit our website\\ + \url{http://fossee.in/} \end{center} \end{block} +\end{frame} #+end_latex diff --git a/saving_plots/slides.tex b/saving_plots/slides.tex index 06d530b..5e37bc2 100644 --- a/saving_plots/slides.tex +++ b/saving_plots/slides.tex @@ -1,6 +1,6 @@ -% Created 2010-10-11 Mon 17:08 +% Created 2011-05-03 Tue 14:50 \documentclass[presentation]{beamer} -\usepackage[latin1]{inputenc} +\usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{fixltx2e} \usepackage{graphicx} @@ -8,7 +8,6 @@ \usepackage{float} \usepackage{wrapfig} \usepackage{soul} -\usepackage{t1enc} \usepackage{textcomp} \usepackage{marvosym} \usepackage{wasysym} @@ -24,14 +23,13 @@ commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, showstringspaces=false, keywordstyle=\color{blue}\bfseries} \providecommand{\alert}[1]{\textbf{#1}} -\title{Savefig} +\title{} \author{FOSSEE} \date{2010-10-11 Mon} \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} \begin{document} -\maketitle @@ -41,101 +39,108 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} + +\begin{frame} + +\begin{center} +\textcolor{blue}{Saving Plots} +\end{center} +\begin{center} +\includegraphics[scale=0.25]{../images/iitb-logo.png}\\ +Developed by FOSSEE Team, IIT-Bombay. \\ +Funded by National Mission on Education through ICT + +MHRD, Govt. of India +\end{center} +\end{frame} \begin{frame} -\frametitle{Outline} -\label{sec-1} +\frametitle{Objectives} +\label{sec-2} + + At the end of this tutorial, you will be able to, \begin{itemize} -\item Saving plots. -\item Plotting in different formats. -\item Locating the file in the file system. +\item Save plots using ``savefig()`` function. +\item Save plots in different formats. \end{itemize} + \end{frame} \begin{frame}[fragile] \frametitle{Creating a basic plot} -\label{sec-2} +\label{sec-3} Plot a sine wave from -3pi to 3pi. -\begin{verbatim} +\lstset{language=Python} +\begin{lstlisting} In []: x = linspace(-3*pi,3*pi,100) In []: plot(x, sin(x)) -\end{verbatim} +\end{lstlisting} \end{frame} \begin{frame}[fragile] \frametitle{savefig()} -\label{sec-3} +\label{sec-4} \begin{itemize} \item savefig() - to save plots -\label{sec-3_1}% +\label{sec-4_1}% \begin{verbatim} syntax: savefig(fname) \end{verbatim} \item example -\label{sec-3_2}% +\label{sec-4_2}% \begin{itemize} -\item savefig('/home/fossee/sine.png') -\label{sec-3_2_1}% +\item savefig('/home/fossee/sine.png')\\ +\label{sec-4_2_1}% \begin{itemize} \item file sine.png saved to the folder /home/fossee \item .png - file type \end{itemize} - \end{itemize} % ends low level \end{itemize} % ends low level \end{frame} \begin{frame} \frametitle{More on savefig()} -\label{sec-4} +\label{sec-5} \begin{itemize} -\item Recall -\label{sec-4_1}% +\item Recall\\ +\label{sec-5_1}% \begin{itemize} \item .png - file type \end{itemize} - \item File types supported -\label{sec-4_2}% +\label{sec-5_2}% \begin{itemize} \item .pdf - PDF(Portable Document Format)\\ -\label{sec-4_2_1}% +\label{sec-5_2_1}% \item .ps - PS(Post Script)\\ -\label{sec-4_2_2}% +\label{sec-5_2_2}% \item .eps - Encapsulated Post Script\\ -\label{sec-4_2_3}% -\texttt{to be used with} \LaTeX{} \texttt{documents} +\label{sec-5_2_3}% +\verb~to be used with~ \LaTeX{} \verb~documents~ \item .svg - Scalable Vector Graphics\\ -\label{sec-4_2_4}% -\texttt{vector graphics} +\label{sec-5_2_4}% +\verb~vector graphics~ \item .png - Portable Network Graphics\\ -\label{sec-4_2_5}% -\texttt{supports transparency} +\label{sec-5_2_5}% +\verb~supports transparency~ \end{itemize} % ends low level \end{itemize} % ends low level \end{frame} \begin{frame} \frametitle{Exercise 1} -\label{sec-5} - - Save the sine plot in the format EPS which can be embedded in \LaTeX{} documents. -\end{frame} -\begin{frame}[fragile] -\frametitle{Solution 1} \label{sec-6} -\begin{verbatim} -savefig('/home/fossee/sine.eps') -\end{verbatim} + Save the sine plot in the format EPS which can be embedded in \LaTeX{} documents. \end{frame} \begin{frame} \frametitle{Exercise 2} @@ -147,39 +152,37 @@ savefig('/home/fossee/sine.eps') \frametitle{Summary} \label{sec-8} - You should now be able to -\begin{itemize} -\item Use \texttt{savefig()} function -\item Save plots in different formats + In this tutorial, we have learnt to – \begin{itemize} -\item PDF -\item PS -\item PNG -\item SVG -\item EPS +\item Save plots using the ``savefig()`` function. +\item Save the plots in differnt formats. +\begin{itemize} +\item pdf +\item ps +\item png +\item svg +\item epg \end{itemize} - -\item Locating the files in file system. +\item Locate files in the file system. \end{itemize} - - \end{frame} \begin{frame} -\frametitle{Thank you!} +\frametitle{Acknowledgement} \label{sec-9} \begin{block}{} \begin{center} - This spoken tutorial has been produced by the - \textcolor{blue}{FOSSEE} team, which is funded by the + \textcolor{blue}{\Large THANK YOU!} \end{center} + \end{block} +\begin{block}{} \begin{center} - \textcolor{blue}{National Mission on Education through \\ - Information \& Communication Technology \\ - MHRD, Govt. of India}. + For more Information, visit our website\\ + \url{http://fossee.in/} \end{center} \end{block} \end{frame} +\end{frame} -\end{document} +\end{document}
\ No newline at end of file diff --git a/using_plot_interactively/oldscript.rst b/using_plot_interactively/oldscript.rst new file mode 100644 index 0000000..cd2ee6a --- /dev/null +++ b/using_plot_interactively/oldscript.rst @@ -0,0 +1,226 @@ +.. Objectives +.. ---------- + +.. By the end of this tutorial you will -- + +.. 1. Create simple plots of mathematical functions +.. #. Use the Figure window to study plots better + + + +.. Prerequisites +.. ------------- + +.. Installation of required tools +.. Ipython + +.. Author : Amit Sethi + Internal Reviewer : + External Reviewer : + Checklist OK? : <put date stamp here, if OK> [2010-10-05] + +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. + +I hope you have IPython running on your computer. + +In this tutorial we will look at plot command and also how to study +the plot using the UI. + +{{{ Show Outline Slide }}} + +Lets start ipython on your shell, type :: + + $ipython -pylab + + +Pylab is a python library which provides plotting functionality.It +also provides many other important mathematical and scientific +functions. After running IPython -pylab in your shell if at the top of +the result of this command, you see something like :: + + + `ERROR: matplotlib could NOT be imported! Starting normal + IPython.` + + +{{{ Slide with Error written on it }}} + + +Then you have to install matplotlib and run this command again. + +Now type in your ipython shell :: + + linpace? + + + +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. :: + + 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 :: + + + 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 :: + + p = linspace(-pi,pi,100) + + +'pi' here is constant defined by pylab. Save this to the variable, p +. + +If you now :: + + 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:: + + plot(p,cos(points)) + + +Here cos(points) gets the cosine value at every corresponding point to +p. + + +We can also save cos(points) to variable cosine and plot it using +plot.:: + + cosine=cos(points) + + plot(p,cosine) + + + +Now do :: + + clf() + +this will clear the plot. + +This is done because any other plot we try to make shall come on the +same drawing area. As we do not wish to clutter the area with +overlaid plots , we just clear it with clf(). Now lets try a sine +plot. :: + + + plot(p,sin(p)) + + + + +The Window on which the plot appears can be used to study it better. + +{{{ Show the slide with all the buttons on it }}} + +First of all moving the mouse around gives us the point where mouse +points at. + +Also we have some buttons the right most among them is +for saving the file. + +Just click on it specifying the name of the file. We will save the plot +by the name sin_curve in pdf format. + + + +{{{ 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. + +Left to the save button is the slider button to specify the margins. + +{{{ 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. + +{{{ 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. + +{{{ Press home button }}} + +The last one is 'home' referring to the initial plot. + + + + +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 + +2. Using linspace function to create `num` equaly spaced points in a region. + +3. Finding length of sequnces using len. + +4. Plotting mathematical functions using plot. + +4. Clearing drawing area using clf + +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 }}} + + + +This tutorial was created as a part of FOSSEE project, NME ICT, MHRD India + + + + Hope you have enjoyed and found it useful. + + Thankyou + + + +Author : Amit Sethi +Internal Reviewer : +Internal Reviewer 2 : diff --git a/using_plot_interactively/script.rst b/using_plot_interactively/script.rst index 5de2c30..00e203a 100644 --- a/using_plot_interactively/script.rst +++ b/using_plot_interactively/script.rst @@ -4,7 +4,7 @@ .. By the end of this tutorial you will -- .. 1. Create simple plots of mathematical functions -.. 2. Use features of graphical window to manipulate plots +.. #. Use the Figure window to study plots better @@ -30,26 +30,22 @@ team along with the logo of MHRD }}} Hello Friends and welcome to the tutorial on creating simple plots using iPython. -I hope you have IPython installed on your computer if not, then refer to the spoken tutorial -on instaling ipython. +I hope you have IPython running on your computer. .. L2 {{{ Show Objective Slide }}} -At the end of this tutorial, you will be able to, - - 1. Create simple plots of mathematical functions. - 2. Use features of graphical window to manipulate plots - - .. R2 +At the end of this tutorial, you will be able to, + 1. Create simple plots of mathematical functions. + #. Use the Figure window to study plots better. .. R3 -To start ipython, Open the terminal and type +Lets start ipython.Open the terminal and type ipython -pylab and hit enter. .. L3 @@ -62,31 +58,21 @@ ipython -pylab and hit enter. Pylab is a python library which provides plotting functionality.It provides many other important mathematical and scientific -functions. -After running IPython -pylab in your shell, -the screen will look like this. - -.. Pause the video for 2 sec then continue. - -But instead if you get the following error like:: - -- show the error slide +functions. After running IPython -pylab in the shell you will see some +information about ipython and pylab followed by the In[1] prompt.But if you get an error like :: `ERROR: matplotlib could NOT be imported! Starting normal IPython.` Then you will have to install the matplotlib and run this command again. -.. Add some instruction to help user to install matplotlib. - .. L4 {{{ Slide with Error written on it }}} .. R5 -To get array of numbers we use linspace command. -Type 'linspace' followed by a '?' mark to get detailed documentation/help of it +Now type 'linspace' followed by a '?' mark in your ipython shell .. L5 @@ -96,9 +82,10 @@ Type 'linspace' followed by a '?' mark to get detailed documentation/help of it .. R6 -As the documentation says, it returns `num` evenly spaced samples, +as the documentation says, it returns `num` evenly spaced samples, calculated over the interval start and stop. To illustrate this, lets try to generate 100 points.Type ``linspace(1,100,100)`` and hit enter. +As you can see a sequence of numbers from 1 to 100 appears. .. L6 @@ -106,11 +93,9 @@ try to generate 100 points.Type ``linspace(1,100,100)`` and hit enter. linspace(1,100,100) -As you can see a sequence of numbers from 1 to 100 appears. - .. R7 -To generate 200 points between 0 and 1, type linspace(0,1,200). +Now lets try to generate 200 points between 0 and 1,we do that by typing linspace(0,1,200). .. L7 @@ -120,10 +105,10 @@ To generate 200 points between 0 and 1, type linspace(0,1,200). .. R8 -Here,0 is the start , 1 is the stop and 200 is the number of points. In linspace +Here,0 is the start , 1 the stop and 200 the number of points.In linspace the start and stop points can be integers, decimals , or constants. -To get 100 points between -pi to pi where 'pi' is a constant -defined by pylab and save the result to the variable,say p. Type p=linspace(-pi,pi,100). +Let's try and get 100 points between -pi to pi.Here 'pi' is a constant +defined by pylab. Save this to the variable,say p. .. L8 @@ -133,7 +118,8 @@ defined by pylab and save the result to the variable,say p. Type p=linspace(-pi, .. R9 -To get the number of elements or points of a sequence say p type ''len(p)'' +If we now type ``len(p)``we will get the no. of points. +``len`` function gives the no of elements of a sequence. .. L9 @@ -144,7 +130,7 @@ To get the number of elements or points of a sequence say p type ''len(p)'' .. R10 -To plot a cosine curve between -pi and pi, we use the plot command. +Let's try and plot a cosine curve between -pi and pi.For this we use the plot command. Here cos(p) gets the cosine value at every point corresponding to point p. @@ -168,7 +154,7 @@ plot function. .. R12 -To clear the plot, use the ``clf()`` function +Now to clear the plot ,we use the ``clf()`` function .. L12 @@ -178,9 +164,8 @@ To clear the plot, use the ``clf()`` function .. R13 -If the plot is not cleared, then any new plot will overlap the previous plot. Hence to avoid -cluttering the area with overlaid plots use clf() function. - +This is done because if we wish to make another plot,it will overlap the previous plot. +As we do not wish to clutter the area with overlaid plots , we just clear it with clf(). Now lets try a sine plot. .. L13 @@ -191,16 +176,15 @@ Now lets try a sine plot. .. R14 -We can manipulate the plot in the graphical window. +We can study the plot better on the plot window by using the various options available on it.Let us have a look at these options. .. L14 -{{{ Show the slide with all the buttons on it }}} +{{{ Show the slide 'Plot UI' }}} .. R15 -The location of the mouse pointer on the window is displayed in bottom right corner of the window. -By moving the mouse pointer the location of each point is seen. +As we can observe, moving the mouse pointer along the plot gives us the location of each point on the plot .. L15 @@ -210,9 +194,9 @@ By moving the mouse pointer the location of each point is seen. To the bottom left of the window,there are a few buttons.The right most among them is for saving the file. -Just click on it and type the file name in the box provided. We will save the plot +Just click on it and type the file name. We will save the plot by the name `sin_curve` in pdf format.As you can see we can specify the format -of file from the dropdown. Formats like png ,eps ,pdf, ps are also available. +of file from the dropdown.Formats like png ,eps ,pdf, ps are available. .. L16 @@ -267,8 +251,7 @@ The last one is 'home' referring to the initial plot. .. R22 -Pause the video and do this exercise. Resume the video once done. - +Pause the video here, try out the following exercise and resume the video. Plot (sin(x)*sin(x))/x. @@ -278,7 +261,7 @@ Pause the video and do this exercise. Resume the video once done. .. L23 -{{{ Summary Slide }}} +{{{ Switch to the Summary Slide }}} .. R23 @@ -287,9 +270,9 @@ Let's revise quickly what we have learnt today 1. To Start Ipython with pylab. #. To Use the linspace function to create `num` equally spaced points in a region. #. To Find the length of sequnces using len function. - #. To Plot mathematical functions using plot function. - #. To Clear drawing area using clf function. - #. Manipulate the plot in the window itself by using functionalities like save, zoom, move, home, arrow buttons. + #. To Plot mathematical functions using plot. + #. To Clear drawing area using clf. + #. To Use the UI of plot for studying it better and using functionalities like save,zoom and moving the plots on x and y axis. .. L24 @@ -315,7 +298,7 @@ And the answers, 2. We use `clf()` function to clear a figure. -3. `len(sequence\_name)` is the function used to find out the length of a sequence. +3. `len(sequence_name)` is the function used to find out the length of a sequence. .. L26 diff --git a/using_plot_interactively/slides.org b/using_plot_interactively/slides.org index 73a638d..ab82eec 100644 --- a/using_plot_interactively/slides.org +++ b/using_plot_interactively/slides.org @@ -62,6 +62,11 @@ MHRD, Govt. of India - Back and Forward Button - Home +* Question1 + 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. * Summary In this tutorial,we have learnt to- diff --git a/using_plot_interactively/slides.tex b/using_plot_interactively/slides.tex index 2e1d36b..ade4ff6 100644 --- a/using_plot_interactively/slides.tex +++ b/using_plot_interactively/slides.tex @@ -1,4 +1,4 @@ -% Created 2010-11-11 Thu 13:15 +% Created 2011-05-04 Wed 11:44 \documentclass[presentation]{beamer} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} @@ -8,7 +8,6 @@ \usepackage{float} \usepackage{wrapfig} \usepackage{soul} -\usepackage{t1enc} \usepackage{textcomp} \usepackage{marvosym} \usepackage{wasysym} @@ -24,14 +23,14 @@ commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, showstringspaces=false, keywordstyle=\color{blue}\bfseries} \providecommand{\alert}[1]{\textbf{#1}} -\title{Using Plot Interactively} +\title{} \author{FOSSEE} \date{} \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} \begin{document} -\maketitle + @@ -42,26 +41,44 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \begin{frame} -\frametitle{Outline} -\label{sec-1} - How to plot a simple mathematical function. - Using the User Interface of plot figure. +\begin{center} +\textcolor{blue}{Using plot Interactively} +\end{center} +\begin{center} +\includegraphics[scale=0.25]{../images/iitb-logo.png}\\ +Developed by FOSSEE Team, IIT-Bombay. \\ +Funded by National Mission on Education through ICT + +MHRD, Govt. of India +\end{center} \end{frame} \begin{frame} -\frametitle{Error if Ipython not installed} +\frametitle{Objectives} \label{sec-2} + + At the end of this tutorial, you will be able to, + +\begin{itemize} +\item Create simple plots of mathematical functions. +\item Use the Figure window to study plots better. +\end{itemize} +\end{frame} +\begin{frame} +\frametitle{Error if Ipython not installed} +\label{sec-3} \begin{itemize} \item `ERROR: matplotlib could NOT be imported! Starting normal IPython.`\\ -\label{sec-2_1}% +\label{sec-3_1}% \end{itemize} % ends low level \end{frame} \begin{frame} \frametitle{Plot UI} -\label{sec-3} +\label{sec-4} \includegraphics[height=0.12in, interpolate=true]{buttons} + \begin{itemize} \item Save \item Zoom @@ -69,31 +86,80 @@ showstringspaces=false, keywordstyle=\color{blue}\bfseries} \item Back and Forward Button \item Home \end{itemize} +\end{frame} +\begin{frame} +\frametitle{Question1} +\label{sec-5} + Plot (sin(x)*sin(x))/x. - +\begin{enumerate} +\item Save the plot by the sinsquarebyx.pdf in pdf format. +\item Zoom and find the maxima. +\item Bring it back to initial position. +\end{enumerate} \end{frame} \begin{frame} \frametitle{Summary} -\label{sec-4} +\label{sec-6} -\begin{itemize} -\item Plotting mathematical functions using plot. - \includegraphics[height=0.12in, interpolate=true]{buttons} -\item Using the UI of plot + In this tutorial,we have learnt to- \begin{itemize} +\item Start Ipython with pylab. +\item Use the linspace function to create `num` equally spaced points in a region. +\item Find the length of sequnces using len function. +\item Plot mathematical functions using plot. +\item Clear drawing area using clf. +\item Plott mathematical functions using plot. +\item Use the UI of plot +\begin{itemize} \item Save \item Zoom \item Move axis \item Back and Forward Button \item Home \end{itemize} - \end{itemize} + +\end{frame} +\begin{frame} +\frametitle{Evaluation} +\label{sec-7} - - + +\begin{enumerate} +\item Create 100 equally spaced points between -pi/2 and pi/2? +\item How do you clear a figure in ipython? +\item How do find the length of a sequen +\end{enumerate} +\end{frame} +\begin{frame} +\frametitle{Solutions\ldots{}} +\label{sec-8} + + +\begin{enumerate} +\item linspace(-pi/2,pi/2,100) +\item clf() +\item len(sequence\_name) +\end{enumerate} +\end{frame} +\begin{frame} +\frametitle{Acknowledgement\ldots{}} +\label{sec-9} + + \begin{block}{} + \begin{center} + \textcolor{blue}{\Large THANK YOU!} + \end{center} + \end{block} +\begin{block}{} + \begin{center} + For more Information, visit our website\\ + \url{http://fossee.in/} + \end{center} + \end{block} \end{frame} -\end{document} +\end{document}
\ No newline at end of file |