Difference between revisions of "Python-3.4.3/C2/Plotting-Data/English"
Pratham920 (Talk | contribs) |
|||
Line 1: | Line 1: | ||
− | '''Python/C2/Plotting data /English''' '''Title of script''': '''Plotting data ''' | + | '''Python/C2/Plotting data /English''' |
+ | |||
+ | |||
+ | '''Title of script''': '''Plotting data ''' | ||
'''Author: Aditya Palaparthy''' | '''Author: Aditya Palaparthy''' | ||
− | '''Keywords: Python, IPython,''' '''plot, title, errorbar''' | + | '''Keywords: Python, IPython,''' '''plot, title, errorbar, video tutorial''' |
{| style="border-spacing:0;" | {| style="border-spacing:0;" | ||
| style="background-color:#ffffff;border:0.5pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.097cm;padding-right:0.191cm;"| <center>'''Visual Cue'''</center> | | style="background-color:#ffffff;border:0.5pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.097cm;padding-right:0.191cm;"| <center>'''Visual Cue'''</center> | ||
Line 83: | Line 86: | ||
− | Type ''' | + | Type '''%pylab '''and press''' Enter.''' |
|- | |- | ||
Line 95: | Line 98: | ||
− | We will be '''plotting''' '''L''' and '''T | + | We will be '''plotting''' '''L''' and '''T square values'''. |
|- | |- | ||
Line 153: | Line 156: | ||
'''3.3489, 3.7636])''' | '''3.3489, 3.7636])''' | ||
− | | style="background-color:#ffffff;border:0.5pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.097cm;padding-right:0.191cm;"| We see the values of | + | | style="background-color:#ffffff;border:0.5pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.097cm;padding-right:0.191cm;"| We see the values of '''tsquare''' |
|- | |- | ||
Line 163: | Line 166: | ||
− | | style="background-color:#ffffff;border:0.5pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.097cm;padding-right:0.191cm;"| Now to '''plot L | + | | style="background-color:#ffffff;border:0.5pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.097cm;padding-right:0.191cm;"| Now to '''plot L versus T square''', we will simply type |
'''plot '''within parentheses''' I '''''comma '''''tsquare '''''comma'' within single quotes '''dot '''and press''' Enter ''' | '''plot '''within parentheses''' I '''''comma '''''tsquare '''''comma'' within single quotes '''dot '''and press''' Enter ''' | ||
Line 232: | Line 235: | ||
− | Type ''' | + | Type '''delta underscore l '''within square bracket the''''' '''values ''and press '''Enter''' |
− | ''' | + | '''delta underscore t '''within square bracket the''''' '''values ''and press '''Enter''' |
|- | |- | ||
Line 244: | Line 247: | ||
− | | style="background-color:#ffffff;border:0.5pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.097cm;padding-right:0.191cm;"| Now to plot L versus T | + | | style="background-color:#ffffff;border:0.5pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.097cm;padding-right:0.191cm;"| Now to plot L versus T square with an '''error bar,''' we use the '''function''' '''errorbar()'''. |
So type, | So type, | ||
− | errorbar within parentheses '''I '''''comma '''''tsquare '''''comma '''''xerr '''''equalto ''''' | + | errorbar within parentheses '''I '''''comma '''''tsquare '''''comma '''''xerr '''''equalto '''''delta underscore I '''''comma '''''y underscore err '''''equalto '''''delta underscore t '''''comma '''''fmt= '''within single quotes '''bo ''' |
'''and press Enter''' | '''and press Enter''' | ||
Line 254: | Line 257: | ||
|- | |- | ||
| style="background-color:#ffffff;border:0.5pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.097cm;padding-right:0.191cm;"| Show plot window | | style="background-color:#ffffff;border:0.5pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.097cm;padding-right:0.191cm;"| Show plot window | ||
− | | style="background-color:#ffffff;border:0.5pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.097cm;padding-right:0.191cm;"| We see plot L versus T | + | | style="background-color:#ffffff;border:0.5pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.097cm;padding-right:0.191cm;"| We see plot L versus T square with an '''error bar''' |
|- | |- | ||
Line 311: | Line 314: | ||
− | # '''Square''' the following '''sequence'''. | + | # '''Square''' the following '''sequence'''.distance underscore values ''equalto within square brackets'' '''2.1,4.6,8.72,9.03''' |
− | + | ||
# Plot L versus T in '''red pluses'''. | # Plot L versus T in '''red pluses'''. | ||
Line 329: | Line 331: | ||
1.To square a sequence of values, we use the function square | 1.To square a sequence of values, we use the function square | ||
− | square ''within parentheses'' | + | square ''within parentheses'' distance underscore values |
2. We pass an additional argument stating the desired parameter | 2. We pass an additional argument stating the desired parameter | ||
Line 365: | Line 367: | ||
Thank You | Thank You | ||
− | | style="background-color:#ffffff;border:0.5pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.097cm;padding-right:0.191cm;"| This is | + | | style="background-color:#ffffff;border:0.5pt solid #000001;padding-top:0cm;padding-bottom:0cm;padding-left:0.097cm;padding-right:0.191cm;"| This is underscore ________ from IIT Bombay signing off. |
Thank You | Thank You | ||
|} | |} |
Revision as of 13:44, 4 September 2017
Python/C2/Plotting data /English
Title of script: Plotting data
Author: Aditya Palaparthy
Keywords: Python, IPython, plot, title, errorbar, video tutorial
|
|
Show Slide
containing title, name of the production team along with the logo of MHRD
|
Hello Friends. Welcome to the tutorial on "Plotting data ". |
Show Slide
Objectives
|
In this tutorial, we will learn about
|
System Requirements
Ubuntu Linux 14.04
|
To record this tutorial, I am using
|
Show Slide
Pre-requisites
|
To practise this tutorial, you should know how to
If not, see the relevant Python tutorials on this website. |
[Terminal]
ipython3
|
Let us first open the Terminal by pressing Ctrl+Alt+T keys simultaneously.
|
[IPython console]
%pylab and press Enter. |
Let us initialise the pylab package.
|
Show Slide
Example - Simple Pendulum |
Let us see an example for plotting the data related to a Simple Pendulum.
|
Show slide
Simple Pendulum Data
|
Let us use the data shown here for plotting. |
[Ipython Terminal]
|
First let us initiate 'l' and 't' values.
We initiate them as sequence of values. This is also called as List. Type l equal to within square brackets values and press Enter t equal to within square brackets the values and press Enter |
[Ipython Terminal]
tsquare=square(t)
|
Now we will obtain square of t by using function square.
Type tsquare=square within parentheses t and press Enter
|
tsquare | Now type
tsquare and press Enter |
show array in terminal
3.3489, 3.7636]) |
We see the values of tsquare |
[Ipython Terminal]
|
Now to plot L versus T square, we will simply type
plot within parentheses I comma tsquare comma within single quotes dot and press Enter |
Show the plot window | We see the required plot. |
[Ipython Terminal]
|
You can also specify 'o' for filled circles.
|
Show plot window | So the plot is clear now |
plot(l,tsquare,'o') | Now type,
plot within parentheses I comma tsquare comma within single quotes o and press Enter
|
Show plot window | We see the plot with filled circles |
Show Slide
Exercise 1 |
Pause the video. Try this exercise and then resume the video
|
Show Slide
Exercise 1 data
|
Use the error data given here for plotting. |
[Ipython Terminal]
delta_t= [0.04,0.08,0.03,0.05,0.03,0.03,0.04,0.07,0.08] |
We shall again initialize the sequence values in the same manner as we did for l and t.
delta underscore t within square bracket the values and press Enter |
[Ipython Terminal]
|
Now to plot L versus T square with an error bar, we use the function errorbar().
So type, errorbar within parentheses I comma tsquare comma xerr equalto delta underscore I comma y underscore err equalto delta underscore t comma fmt= within single quotes bo and press Enter |
Show plot window | We see plot L versus T square with an error bar |
[Ipython Terminal]
|
You can explore other options of errorbar using the documentation of errorbar.
That is, errorbar question mark |
Show Slide
Exercise 2
|
Pause the video. Try this exercise and then resume the video.
|
Show Slide
Exercise 2 data |
Use the data given here for plotting. |
Show Slide
Summary slide
|
This brings us to the end of this tutorial. In this tutorial, we have learned to,
|
Show Slide
Evaluation
|
Here are some self assessment questions for you to solve.
|
Show Slide
Solutions
|
And the answers,
square within parentheses distance underscore values 2. We pass an additional argument stating the desired parameter plot within parentheses L comma T comma within single quotes r plus for red pluses |
Show Slide
Forum |
Please post your timed queries in this forum. |
Show Slide
Fossee Forum |
Please post your general queries on Python in this forum. |
Show Slide
Textbook Companion |
FOSSEE team coordinates the TBC project. |
Show Slide
Acknowledgement |
Spoken-tutorial is funded by NMEICT, MHRD, Govt. of India.
For more details, visit this website. |
Show Slide
Thank You |
This is underscore ________ from IIT Bombay signing off.
Thank You |