equal
deleted
inserted
replaced
18 |
18 |
19 In this tutorial we will cover scatter plot, pie chart, bar chart and |
19 In this tutorial we will cover scatter plot, pie chart, bar chart and |
20 log plot. We will also see few other plots and also introduce you to |
20 log plot. We will also see few other plots and also introduce you to |
21 the matplotlib help. |
21 the matplotlib help. |
22 |
22 |
23 |
|
24 Let us start with scatter plot. |
23 Let us start with scatter plot. |
25 |
24 |
26 {{{ switch to the next slide }}} |
25 {{{ switch to the next slide }}} |
27 |
26 |
28 In a scatter plot, the data is displayed as a collection of points, |
27 In a scatter plot, the data is displayed as a collection of points, |
53 first line representing years and the second line representing the |
52 first line representing years and the second line representing the |
54 profit percentages. |
53 profit percentages. |
55 |
54 |
56 {{{ close the file and switch to the terminal }}} |
55 {{{ close the file and switch to the terminal }}} |
57 |
56 |
58 To product the scatter plot first we need to load the data from the |
57 To produce the scatter plot first we need to load the data from the |
59 file using ``loadtxt``. We learned in one of the previous sessions, |
58 file using ``loadtxt``. We learned in one of the previous sessions, |
60 and it can be done as :: |
59 and it can be done as :: |
61 |
60 |
62 year,profit = loadtxt('/home/fossee/other-plot/company-a-data.txt',dtype=type(int())) |
61 year,profit = |
|
62 loadtxt('/home/fossee/other-plot/company-a-data.txt',dtype=type(int())) |
63 |
63 |
64 Now in-order to generate the scatter graph we will use the function |
64 Now in-order to generate the scatter graph we will use the function |
65 ``scatter()`` |
65 ``scatter()`` |
66 :: |
66 :: |
67 |
67 |
98 We can plot the pie chart using the function ``pie()``. |
98 We can plot the pie chart using the function ``pie()``. |
99 :: |
99 :: |
100 |
100 |
101 pie(profit,labels=year) |
101 pie(profit,labels=year) |
102 |
102 |
103 Notice that we passed two arguments to the function ``pie()``. The |
103 Notice that we passed two arguments to the function ``pie()``. First |
104 first one the values and the next one the set of labels to be used in |
104 one the values and the next one the set of labels to be used in the |
105 the pie chart. |
105 pie chart. |
106 |
106 |
107 {{{ switch to the next slide which has the problem statement of |
107 {{{ switch to the next slide which has the problem statement of |
108 problem to be tried out }}} |
108 problem to be tried out }}} |
109 |
109 |
110 Now here is a question for you to try out, plot a pie chart with the |
110 Now here is a question for you to try out, plot a pie chart with the |
193 matplotlib over the internet. |
193 matplotlib over the internet. |
194 |
194 |
195 Help about matplotlib can be obtained from |
195 Help about matplotlib can be obtained from |
196 matplotlib.sourceforge.net/contents.html |
196 matplotlib.sourceforge.net/contents.html |
197 |
197 |
198 .. #[[Anoop: I am not so sure how to do the rest of it, so I guess we |
198 |
199 can just browse through the side and tell them few. What is your |
199 More plots can be seen at |
200 opinion??]] |
200 matplotlib.sourceforge.net/users/screenshots.html and also at |
201 |
201 matplotlib.sourceforge.net/gallery.html |
202 Now let us see few plots from |
|
203 matplotlib.sourceforge.net/users/screenshots.html |
|
204 |
|
205 {{{ browse through the site quickly }}} |
|
206 |
202 |
207 {{{ switch to recap slide }}} |
203 {{{ switch to recap slide }}} |
208 |
204 |
209 Now we have come to the end of this tutorial. We have covered scatter |
205 Now we have come to the end of this tutorial. We have covered scatter |
210 plot, pie chart, bar chart, log-log plot and also saw few other plots |
206 plot, pie chart, bar chart, log-log plot and also saw few other plots |