diff options
Diffstat (limited to 'using-plot-interactively')
-rw-r--r-- | using-plot-interactively/buttons.png | bin | 0 -> 5214 bytes | |||
-rw-r--r-- | using-plot-interactively/home.png | bin | 0 -> 996 bytes | |||
-rw-r--r-- | using-plot-interactively/move.png | bin | 0 -> 606 bytes | |||
-rw-r--r-- | using-plot-interactively/quickref.tex | 14 | ||||
-rw-r--r-- | using-plot-interactively/save.png | bin | 0 -> 676 bytes | |||
-rw-r--r-- | using-plot-interactively/script.rst | 212 | ||||
-rw-r--r-- | using-plot-interactively/slides.org | 37 | ||||
-rw-r--r-- | using-plot-interactively/slides.tex | 71 | ||||
-rw-r--r-- | using-plot-interactively/zoom.png | bin | 0 -> 947 bytes |
9 files changed, 334 insertions, 0 deletions
diff --git a/using-plot-interactively/buttons.png b/using-plot-interactively/buttons.png Binary files differnew file mode 100644 index 0000000..7b39d24 --- /dev/null +++ b/using-plot-interactively/buttons.png diff --git a/using-plot-interactively/home.png b/using-plot-interactively/home.png Binary files differnew file mode 100644 index 0000000..dd21f5b --- /dev/null +++ b/using-plot-interactively/home.png diff --git a/using-plot-interactively/move.png b/using-plot-interactively/move.png Binary files differnew file mode 100644 index 0000000..538ed1f --- /dev/null +++ b/using-plot-interactively/move.png diff --git a/using-plot-interactively/quickref.tex b/using-plot-interactively/quickref.tex new file mode 100644 index 0000000..6f0451f --- /dev/null +++ b/using-plot-interactively/quickref.tex @@ -0,0 +1,14 @@ +Creating a linear array:\\ +{\ex \lstinline| x = linspace(0, 2*pi, 50)|} + +Plotting two variables:\\ +{\ex \lstinline| plot(x, sin(x))|} + +Saving Plot\\ +{\includegraphics[width=60mm]{save.png}} + +Zooming into a part of the plot\\ +{\includegraphics[width=60mm]{zoom.png}} + +Move the plot\\ +{\includegraphics[width=60mm]{move.png}} diff --git a/using-plot-interactively/save.png b/using-plot-interactively/save.png Binary files differnew file mode 100644 index 0000000..b1a6757 --- /dev/null +++ b/using-plot-interactively/save.png diff --git a/using-plot-interactively/script.rst b/using-plot-interactively/script.rst new file mode 100644 index 0000000..21af31b --- /dev/null +++ b/using-plot-interactively/script.rst @@ -0,0 +1,212 @@ +.. 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 +------- + + +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. + +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 :: + + In[]: 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. :: + + In[]: 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) + +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) + + +'pi' here is constant defined by pylab. Save this to the variable, p +. + +If you now :: + + In[]: 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 :: + + + In[]: 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.:: + + In[]: cosine=cos(points) + + In[]: plot(p,cosine) + + + +Now do :: + + In[]: 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. :: + + + In []: 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. + + + +{{{ Action corelating with the words }}} + +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. + +{{{ Action corelating with the words }}} + +Left to this is zoom button to zoom into the plot. Just specify the +region to zoom into. +The button left to it can be used to move the axes of the plot. + +{{{ Action corelating with the words }}} + +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 }}} + +The last one is 'home' referring to the initial plot. + +{{{ Action corelating with the words}}} + + + +{{{ 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/slides.org b/using-plot-interactively/slides.org new file mode 100644 index 0000000..29b7d8d --- /dev/null +++ b/using-plot-interactively/slides.org @@ -0,0 +1,37 @@ +#+LaTeX_CLASS: beamer +#+LaTeX_CLASS_OPTIONS: [presentation] +#+BEAMER_FRAME_LEVEL: 1 + +#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\useoutertheme{infolines}\usecolortheme{default}\setbeamercovered{transparent} +#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra) +#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC +#+OPTIONS: H:5 num:t toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t + +#+TITLE: Plotting Data +#+AUTHOR: FOSSEE +#+DATE: 2010-09-14 Tue +#+EMAIL: info@fossee.in + +# \author[FOSSEE] {FOSSEE} + +# \institute[IIT Bombay] {Department of Aerospace Engineering\\IIT Bombay} +# \date{} + +* Tutorial Plan +** Creating a simple plot +** Use the buttons on window to study the plot + +* Error if Ipython not installed + +** `ERROR: matplotlib could NOT be imported! Starting normal IPython.` + +* Plot UI + +* Summary + +** Start Ipython with pylab +** Using linspace +** Finding length of sequnces using len. +** Plotting mathematical functions using plot. +** Clearing drawing area using clf +** Using the UI of plot diff --git a/using-plot-interactively/slides.tex b/using-plot-interactively/slides.tex new file mode 100644 index 0000000..6999f43 --- /dev/null +++ b/using-plot-interactively/slides.tex @@ -0,0 +1,71 @@ +% Created 2010-10-20 Wed 21:57 +\documentclass[presentation]{beamer} +\usetheme{Warsaw}\useoutertheme{infolines}\usecolortheme{default}\setbeamercovered{transparent} +\usepackage[latin1]{inputenc} +\usepackage[T1]{fontenc} +\usepackage{graphicx} +\usepackage{longtable} +\usepackage{float} +\usepackage{wrapfig} +\usepackage{soul} +\usepackage{amssymb} +\usepackage{hyperref} + + +\title{Plotting Data } +\author{FOSSEE} +\date{2010-09-14 Tue} + +\begin{document} + +\maketitle + +\begin{frame} +\frametitle{Tutorial Plan} +\label{sec-1} +\begin{itemize} + +\item Creating a simple plot\\ +\label{sec-1.1}% +\item Use the buttons on window to study the plot\\ +\label{sec-1.2}% +\end{itemize} % ends low level +\end{frame} +\begin{frame} +\frametitle{Error if Ipython not installed} +\label{sec-2} +\begin{itemize} + +\item `ERROR: matplotlib could NOT be imported! Starting normal IPython.`\\ +\label{sec-2.1}% +\end{itemize} % ends low level +\end{frame} +\begin{frame} +\frametitle{Plot UI} +\label{sec-3} +\begin{frame} + \begin{center} + \includegraphics[height=1.0in,width=4.2in]{buttons.png} + \end{center} +\end{frame} + +\frametitle{Summary} +\label{sec-4} +\begin{itemize} + +\item Start Ipython with pylab\\ +\label{sec-4.1}% +\item Using linspace\\ +\label{sec-4.2}% +\item Finding length of sequnces using len.\\ +\label{sec-4.3}% +\item Plotting mathematical functions using plot.\\ +\label{sec-4.4}% +\item Clearing drawing area using clf\\ +\label{sec-4.5}% +\item Using the UI of plot\\ +\label{sec-4.6}% +\end{itemize} % ends low level +\end{frame} + +\end{document} diff --git a/using-plot-interactively/zoom.png b/using-plot-interactively/zoom.png Binary files differnew file mode 100644 index 0000000..c1a7fdf --- /dev/null +++ b/using-plot-interactively/zoom.png |