diff options
Diffstat (limited to 'embellishing_a_plot')
-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 |
3 files changed, 93 insertions, 172 deletions
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 |