multiple_plots/questions.rst
author Anoop Jacob Thomas<anoop@fossee.in>
Sat, 18 Dec 2010 12:54:49 +0530
changeset 524 b602b4dcc87d
parent 522 d33698326409
permissions -rw-r--r--
Made some changes to the script embellishing a plot, but it still needs changes.

Objective Questions
-------------------

.. A mininum of 8 questions here (along with answers)

1. Multiple plots appear in different figures by default. True or False?

   Answer: False

#. What command is used to get individual plots separately?

   Answer: Figure

#. Which figure is closed after the following commands are run? 

:: 

  x = linspace(0, 50, 500)
  figure(1)
  plot(x, sin(x), 'b')
  figure(2)
  plot(x, cos(x), 'g')
  xlabel('x')
  ylabel('cos(x)')
  close()

  Answer: Figure 2

#. Describe the plot obtained by the following commands::

  x = linspace(0, 50, 500)
  subplot(2, 1, 1)
  plot(x, sin(x), 'b')    

Answer: A figure window with space for 2 plots one below the other is
        obtained. The sine plot with blue line appears in the first row. 

#. Describe the plot obtained by the following commands::

  x = linspace(0, 50, 500)
  subplot(2, 1, 1)
  plot(x, sin(x), 'b')
  subplot(2, 1, 2)
  plot(x, cos(x), 'g')

  Answer: 2 plots one below another. sine in blue on first row. cosine
  in green in the second row. 

#. Describe the plot obtained by the following commands::

  x = linspace(0, 50, 500)
  subplot(2, 1, 1)
  plot(x, sin(x), 'b')
  subplot(2, 1, 2)
  plot(x, cos(x), 'g')
  subplot(2, 1, 1)
  plot(x, tan(x), 'r')

  Answer: 2 plots one below another. tan in red on first row. cosine
  in green in the second row. 

  
#. Which of the following gives the correct legend for the commands below
   
   a. legend([sin, cos, tan])
   #. legend([tan, cos, sin])
   #. legend[(tan, cos, sin)]
   #. legend(['sin', 'cos', 'tan'])
   #. legend(['tan', 'cos', 'sin'])

::

  x = linspace(0, 50, 500)
  figure(1)
  plot(x, sin(x), 'b')
  figure(2)
  plot(x, cos(x), 'g')
  figure(3)
  plot(x, tan(x), 'b')

   Answer: legend(['tan', 'cos', 'sin'])

Larger Questions
----------------

.. A minimum of 2 questions here (along with answers)

1. Question 1
2. Question 2