Adding texts to our graph
In the following example, we simply insert a text. Remember that the x
and y
scale is from 0
to 1
:
>>>from pylab import * >>>x = [0,1,2] >>>y = [2,4,6] >>>plot(x,y) >>>figtext(0.2, 0.7, 'North & West') >>>figtext(0.7, 0.2, 'East & South') >>>show()
The corresponding output graph is given as follows:
Let's make it more complex. From the National Bureau of Economic Research web page at http://www.nber.org/cycles.html, we can find the following table showing the business cycle in the past two decades:
Turning Point Date |
Peak or Trough |
Announcement Date |
---|---|---|
June 1, 2009 |
Trough |
September 20, 2010 |
December 1, 2007 |
Peak |
December 1, 2008 |
November 1, 2001 |
Trough |
July 17, 2003 |
March 1, 2001 |
Peak |
November 26, 2001 |
March 1, 1991 |
Trough |
December 22, 1992 |
July 1, 1990 |
Peak |
April 25, 1991 |
November 1, 1982 |
Trough |
July 8, 1983 |
July 1, 1981 |
Peak |
June 1, 1982 |
July... |