embellishing_a_plot/slides.org
author anand
Thu, 11 Nov 2010 00:03:57 +0530
changeset 472 fcdec2d28c9a
parent 273 1639ef25a231
permissions -rw-r--r--
Checklist OK for `The other kinds of plots`
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
273
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     1
#+LaTeX_CLASS: beamer
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     2
#+LaTeX_CLASS_OPTIONS: [presentation]
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     3
#+BEAMER_FRAME_LEVEL: 1
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     4
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     5
#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent}
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     6
#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra)
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     7
#+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
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     8
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     9
#+LaTeX_CLASS: beamer
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    10
#+LaTeX_CLASS_OPTIONS: [presentation]
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    11
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    12
#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl}
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    13
#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet}
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    14
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    15
#+LaTeX_HEADER:\usepackage{listings}
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    16
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    17
#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries,
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    18
#+LaTeX_HEADER:  commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen},
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    19
#+LaTeX_HEADER:  showstringspaces=false, keywordstyle=\color{blue}\bfseries}
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    20
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    21
#+TITLE:    Embellishing a Plot
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    22
#+AUTHOR:    FOSSEE
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    23
#+EMAIL:     
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    24
#+DATE:    
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    25
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    26
#+DESCRIPTION: 
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    27
#+KEYWORDS: 
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    28
#+LANGUAGE:  en
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    29
#+OPTIONS:   H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    30
#+OPTIONS:   TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    31
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    32
* Outline
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    33
  + Modifying the color, line style & linewidth of a plot
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    34
  + Adding a title to the plot (with embedded LaTeX)
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    35
  + Labelling the axes
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    36
  + Annotating the plot
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    37
  + Setting the limits of axes. 
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    38
* Question 1
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    39
  Plot sin(x) in blue colour and with linewidth as 3
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    40
* Solution 1
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    41
  #+begin_src python
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    42
    In []: clf()
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    43
    In []: plot(x, sin(x), 'b', linewidth=3)
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    44
  #+end_src
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    45
* Question 2
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    46
  Plot the sine curve with green filled circles.
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    47
* Solution 2
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    48
  #+begin_src python
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    49
    In []: clf()
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    50
    In []: plot(x, cos(x), 'go')
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    51
  #+end_src
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    52
* Question 3
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    53
  Plot the curve of x vs tan(x) in red dashed line and linewidth 3
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    54
* Solution 3
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    55
  #+begin_src python
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    56
    In []: clf()
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    57
    In []: plot(x, cos(x), 'r--')
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    58
  #+end_src
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    59
* Question 4
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    60
  Change the title of the figure such that the whole title is
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    61
  formatted in LaTex style
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    62
* Solution 4 
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    63
  #+begin_src python
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    64
    In []: title("$Parabolic function -x^2+4x-5$")
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    65
  #+end_src
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    66
* Question 5
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    67
  Set the x and y labels as "x" and "f(x)" in LaTex style.
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    68
* Solution 5
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    69
  #+begin_src python
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    70
    In []: xlabel("$x$")
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    71
    In []: yalbel("$f(x)$")
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    72
  #+end_src
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    73
* Question 6
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    74
  Make an annotation called "root" at the point (-4, 0). What happens
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    75
  to the first annotation?
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    76
* Solution 6
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    77
  #+begin_src python
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    78
    In []: annotate("root", xy=(-4,0))  
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    79
  #+end_src
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    80
* Question 7
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    81
  Set the limits of axes such that the area of interest is the
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    82
  rectangle (-1, -15) and (3, 0)
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    83
* Solution 7
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    84
  #+begin_src python
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    85
    In []: xlim(-1, 3)
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    86
    In []: ylim(-15, 0)
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    87
  #+end_src
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    88
* Summary
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    89
  + Modifying the attributes of plot by passing additional arguments
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    90
  + How to add title
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    91
  + How to incorporate LaTeX style formatting
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    92
  + How to label x and y axes
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    93
  + How to add annotations
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    94
  + How to set the limits of axes
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    95
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    96
* Thank you!
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    97
#+begin_latex
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    98
  \begin{block}{}
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    99
  \begin{center}
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   100
  This spoken tutorial has been produced by the
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   101
  \textcolor{blue}{FOSSEE} team, which is funded by the 
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   102
  \end{center}
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   103
  \begin{center}
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   104
    \textcolor{blue}{National Mission on Education through \\
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   105
      Information \& Communication Technology \\ 
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   106
      MHRD, Govt. of India}.
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   107
  \end{center}  
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   108
  \end{block}
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   109
#+end_latex
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   110
1639ef25a231 Slides for embellishing a plot LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   111