saving_plots/script.rst
author Puneeth Chaganti <punchagan@fossee.in>
Wed, 01 Dec 2010 16:51:35 +0530
changeset 522 d33698326409
permissions -rw-r--r--
Renamed all LOs to match with their names in progress.org.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
522
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     1
.. Objectives
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     2
.. ----------
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     3
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     4
.. At the end of this tutorial, you will be able to 
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     5
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     6
.. 1. Save plots using ``savefig()`` function.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     7
.. #. Save plots in different formats.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     8
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
     9
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    10
.. Prerequisites
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    11
.. -------------
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    12
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    13
..   1. should have ``ipython`` and ``pylab`` installed. 
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    14
..   #. getting started with ``ipython``.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    15
..   #. using plot command interactively.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    16
     
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    17
.. Author              : Anoop Jacob Thomas <anoop@fossee.in>
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    18
   Internal Reviewer   : Puneeth
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    19
   External Reviewer   :
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    20
   Language Reviewer   : Bhanukiran
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    21
   Checklist OK?       : <10-11-2010, Anand, OK> [2010-10-05]
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    22
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    23
.. #[Puneeth: Quickref missing.]
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    24
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    25
=======
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    26
Savefig
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    27
=======
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    28
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    29
{{{ Show the first slide }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    30
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    31
Hello and welcome to the tutorial saving plots.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    32
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    33
{{{ switch to next slide, outline slide }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    34
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    35
In this tutorial you will learn how to save plots using Python, saving
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    36
in different formats, and locating the file in the file system.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    37
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    38
.. #[Puneeth: file-system is too technical.]
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    39
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    40
{{{ switch to next slide, a sine wave}}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    41
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    42
Start your IPython interpreter with the command ::
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    43
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    44
  ipython -pylab
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    45
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    46
As you know, it will start your IPython interpreter with the required
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    47
python modules for plotting and saving your plots.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    48
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    49
{{{ Open ipython }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    50
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    51
Now let us plot something, let us plot a sine wave from minus 3 pi to
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    52
3 pi. Let us start by calculating the required points for the plot. It
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    53
can be done using linspace as, ::
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    54
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    55
  x = linspace(-3*pi,3*pi,100)
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    56
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    57
We have stored required points in x. Now let us plot the points using
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    58
the statement ::
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    59
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    60
  plot(x,sin(x))
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    61
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    62
{{{ Keep the plot open }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    63
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    64
Done! we have made a very basic sine plot, now let us see how to save
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    65
the plot for future use so that you can embed the plot in your
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    66
reports.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    67
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    68
.. #[Puneeth: All this is known stuff. You don't have to elaborate so
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    69
.. much on it. Just say, let us plot sin function from -3 pi to 3
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    70
.. pi. Show the commands, and be done with it. ]
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    71
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    72
{{{ switch to next slide, savefig() }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    73
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    74
{{{ Switch the focus to IPython interpreter window }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    75
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    76
For saving the plot, we will use ``savefig()`` function, and it has to be
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    77
done with the plot window open. The statement is, ::
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    78
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    79
  savefig('/home/fossee/sine.png')
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    80
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    81
Notice that ``savefig`` function takes one argument which is the
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    82
filename. The last 3 characters after the ``.`` in the filename is the
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    83
extension or type of the file which determines the format in which you
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    84
want to save.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    85
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    86
.. #[Puneeth: removed mention of string]
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    87
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    88
.. #[[Anoop: I think this treatment is better :) ]]
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    89
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    90
{{{ Highlight the /home/fossee part using mouse movements }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    91
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    92
Also, note that we gave the full path or the absolute path to which we
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    93
want to save the file.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    94
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    95
{{{ Highlight the .png part using mouse movements }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    96
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    97
Here I have used an extension ``.png`` which means I want to save the
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    98
image as a PNG file.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
    99
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   100
Now let us locate ``sine.png`` file saved. We saved the file to
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   101
``/home/fossee`` so let us navigate to ``/home/fossee`` using the
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   102
file browser.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   103
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   104
{{{ Open the browser, navigate to /home/fossee and highlight the file
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   105
sine.png }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   106
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   107
Yes, the file ``sine.png`` is here and let us check it.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   108
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   109
{{{ Open the file sine.png and show it for two-three seconds and then
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   110
close it and return to IPython interpreter, make sure the plot window
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   111
is still open, also don't close the file browser window }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   112
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   113
{{{ switch to next slide, More on savefig() }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   114
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   115
So in-order to save a plot, we use ``savefig`` function. ``savefig``
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   116
can save the plot in many formats, such as pdf - portable document
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   117
format, ps - post script, eps - encapsulated post script, svg -
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   118
scalable vector graphics, png - portable network graphics which
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   119
support transparency etc.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   120
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   121
.. #[[slide must give the extensions for the files - Anoop]]
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   122
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   123
{{{ switch to next slide, exercise 1 }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   124
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   125
Let us now try to save the plot in eps format. ``eps`` stands for
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   126
encapsulated post script, and it can be embedded in your latex
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   127
documents. Pause here and try to figure it out yourself.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   128
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   129
{{{ Switch focus to the already open plot window }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   130
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   131
We still have the sine plot with us, and now let us save the plot as
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   132
``sine.eps``.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   133
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   134
{{{ switch to next slide, solution 1 }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   135
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   136
{{{ Switch focus to IPython interpreter }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   137
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   138
Now, We will save the plot using the function ``savefig`` ::
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   139
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   140
  savefig('/home/fossee/sine.eps')
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   141
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   142
{{{ Switch focus to file browser window }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   143
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   144
Now let us go to ``/home/fossee`` and see the new file created.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   145
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   146
{{{ Highlight the file sine.eps with a single mouse click for 2
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   147
seconds and then double click and open the file }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   148
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   149
Yes! the new file ``sine.eps`` is here.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   150
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   151
{{{ switch to next slide, exercise 2 }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   152
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   153
Now you may try saving the same in pdf, ps, svg formats.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   154
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   155
{{{ Switch to summary slide }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   156
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   157
This brings us to the end of this tutorial, in this tutorial we
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   158
learned to save plots using the function ``savefig()``. Saving the
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   159
plots in different formats and locating the files in the file system.
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   160
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   161
{{{ switch to Thank you slide }}}
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   162
d33698326409 Renamed all LOs to match with their names in progress.org.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff changeset
   163
Thank you!