Keywords: US Trade Balance 1960 2009.svg en United States Balance of Trade 1960 “2009 Data Source US Census Bureau Foreign Trade Division http //www census gov/foreign-trade/statistics/historical/gands txt<br>Green dots Positive trade balance<br>Red dots Negative trade balance i e trade deficit own Morn the Gorn 2010-08-28 thumb left Same data but plotted for 1980 to 2009 only Code Made with Matplotlib <source lang python > /usr/bin/env python from pylab import rc 'xtick major' pad 8 from http //www census gov/foreign-trade/statistics/historical/gands txt d 3 508 4 195 3 370 4 210 6 022 4 664 2 939 2 604 0 250 0 091 2 254 -1 302 -5 443 1 900 -4 293 12 404 -6 082 -27 246 -29 763 -24 565 -19 407 -16 172 -24 156 -57 767 -109 072 -121 880 -138 538 -151 684 -114 566 -93 141 -80 864 -31 135 -39 212 -70 311 -98 493 -96 384 -104 065 -108 273 -166 140 -264 239 -378 780 -364 393 -420 524 -494 183 -609 345 -714 176 -759 240 -702 099 -698 802 -374 908 start end 1960 2009 y range start end+1 f figure figsize 8 5 5 5 ax f add_axes 13 18 8 75 plot y d 'b-' lw 1 5 for a b in zip y d if b > 0 plot a b 'go' ms 3 5 mec 'g' else plot a b 'ro' ms 3 5 mec 'r' grid ls '-' alpha 4 xlabel 'Year' ylabel 'Billions USD' title 'U S Trade Balance' text 2010 -950 'Data Source US Census Bureau Foreign Trade Division' va 'bottom' ha 'right' size 10 axis 1960 2010 -800 100 savefig US Trade Balance 1960 2009 svg show </source> Economy of the United States Balance of trade Line charts Created with Matplotlib Images with Python source code |