author | anand |
Mon, 08 Nov 2010 01:36:47 +0530 | |
changeset 455 | f5b7d0b693d9 |
parent 353 | e13e3452c599 |
permissions | -rw-r--r-- |
261
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
1 |
Objective Questions |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
2 |
------------------- |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
3 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
4 |
.. A mininum of 8 questions here (along with answers) |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
5 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
6 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
7 |
1. What argument can be used with savefig to increase the resolution |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
8 |
of the plot while saving a plot. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
9 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
10 |
a. fname |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
11 |
#. transparency |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
12 |
#. dpi |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
13 |
#. format |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
14 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
15 |
Answer: dpi |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
16 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
17 |
2. The fname argument of savefig has to be always absolute path. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
18 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
19 |
a. True |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
20 |
#. False |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
21 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
22 |
Answer: False |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
23 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
24 |
3. You are right now in the directory `/home/fossee`, from the |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
25 |
following which one is the correct one in-order to save the plot as |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
26 |
svg with the filename `plot` to the directory `/home/fossee/sine/` |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
27 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
28 |
a. savefig('/sine/plot.svg') |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
29 |
#. savefig('sine/plot.svg') |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
30 |
#. savefig('home/fossee/sine/plot.svg') |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
31 |
#. All of these |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
32 |
#. None of the above |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
33 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
34 |
Answer: savefig('sine/plot.svg') |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
35 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
36 |
4. Which is the best image format to be used with Latex documents |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
37 |
which savefig supports? |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
38 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
39 |
a. SVG - Scalable Vector Graphics |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
40 |
#. EPS - Encapsulated Post Script |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
41 |
#. PS - Post Script |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
42 |
#. PNG - Portable Network Graphics |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
43 |
#. None of the above |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
44 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
45 |
Answer: EPS - Encapsulated Post Script |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
46 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
47 |
5. ``savefig('sine.png')`` saves the plot in, |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
48 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
49 |
a. The root directory ``/`` (on GNU/Linux, Unix based systems) |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
50 |
``c:\`` (on windows). |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
51 |
#. Will result in an error as full path is not supplied. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
52 |
#. The current working directory. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
53 |
#. Predefined directory like ``/documents``. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
54 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
55 |
Answer: The current working directory. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
56 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
57 |
6. Study the following code and tell what will happen, |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
58 |
:: |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
59 |
savefig('cosine.png',facecolor='blue') |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
60 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
61 |
a. Will generate an error as plot statements are missing |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
62 |
#. Will generate an error as full path is not specified |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
63 |
#. Create a file ``cosine.png`` with blue background at the current |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
64 |
working directory. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
65 |
#. Create a file ``cosine.png`` with blue background at a |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
66 |
predefined directory like ``/documents``. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
67 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
68 |
Answer: Create a file ``cosine.png`` with blue background at the |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
69 |
current working directory. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
70 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
71 |
7. How to save the below plot as ``sine_green_border.png`` with green |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
72 |
color border/edge in the current working directory. The plot is given |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
73 |
as, |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
74 |
:: |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
75 |
x = linspace(-5*pi,5*pi,200) |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
76 |
plot(x,sin(x),linewidth=2) |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
77 |
legend(['sin(x)']) |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
78 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
79 |
a. ``savefig('sine_green_border.png',bordercolor='green')`` |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
80 |
#. ``savefig('sine_green_border.png',facecolor='green')`` |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
81 |
#. ``savefig('sine_green_border.png',edgecolor='green')`` |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
82 |
#. ``savefig('/sine_green_border.png',bordercolor='green')`` |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
83 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
84 |
Answer: savefig('sine_green_border.png',edgecolor='green') |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
85 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
86 |
8. Given the below code snippet, what does it do? |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
87 |
:: |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
88 |
x = linspace(-5*pi,5*pi,200) |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
89 |
plot(x,sin(x),linewidth=2) |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
90 |
legend(['sin(x)']) |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
91 |
savefig('sine.png',format='pdf',papertype='a4') |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
92 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
93 |
a. Save the sine plot in file sine.png as a pdf file in page-size |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
94 |
A4 and saves it into the current working directory |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
95 |
#. Save the sine plot in file sine.png.pdf in page-size A4 into the |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
96 |
current working directory. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
97 |
#. Save the sine plot in a file sine.png in png format with |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
98 |
page-size A4 in the current working directory overriding the |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
99 |
format argument |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
100 |
#. Error in filename and format mismatch. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
101 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
102 |
Answer: Save the sine plot in file sine.png as a pdf file in page-size |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
103 |
A4 and saves it into the current working directory |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
104 |
|
353
e13e3452c599
Reviewed savefig script.
Puneeth Chaganti <punchagan@gmail.com>
parents:
261
diff
changeset
|
105 |
.. #[Puneeth: Good questions, but can we use it in quiz? most of it |
e13e3452c599
Reviewed savefig script.
Puneeth Chaganti <punchagan@gmail.com>
parents:
261
diff
changeset
|
106 |
.. has not been taught in the tutorial.] |
e13e3452c599
Reviewed savefig script.
Puneeth Chaganti <punchagan@gmail.com>
parents:
261
diff
changeset
|
107 |
|
261
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
108 |
Larger Questions |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
109 |
---------------- |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
110 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
111 |
.. A minimum of 2 questions here (along with answers) |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
112 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
113 |
1. Plot a cosine plot from -2pi to 2pi in green color taking 300 |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
114 |
points. Title the plot as 'Cosine plot' and the legend plot with |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
115 |
'cos(x)'. And save the plot as a pdf file with the filename |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
116 |
cosine_plot. |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
117 |
|
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
118 |
2. Plot tan(x) where x varies from -4pi to 4pi in red color taking 600 |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
119 |
points. Title the plot as 'Tan plot' and the legend plot with |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
120 |
'tan(x)'. And save the plot as a svg file with the filename |
c7f0069d698a
added base scripts and questions except for matrices and other-type-of-plots. previous commit only removed unwanted files.
anoop
parents:
diff
changeset
|
121 |
tangent_plot. |
353
e13e3452c599
Reviewed savefig script.
Puneeth Chaganti <punchagan@gmail.com>
parents:
261
diff
changeset
|
122 |
|
e13e3452c599
Reviewed savefig script.
Puneeth Chaganti <punchagan@gmail.com>
parents:
261
diff
changeset
|
123 |