multiple-plots/questions.rst
author bhanu
Mon, 08 Nov 2010 01:34:02 +0530
changeset 454 0c69c2b32183
parent 311 3f942b8d3f2f
permissions -rw-r--r--
Language check done for the script `strings`

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