source: qesdi/linplot/trunk/tests/linplot_tests/draw/draw_data.py @ 6446

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/qesdi/linplot/trunk/tests/linplot_tests/draw/draw_data.py@6446
Revision 6446, 777 bytes checked in by pnorton, 11 years ago (diff)

Made several changes to try and improve the layout of the plot. Also introduced rotating axis labels to avoid labels being drawn on top of each other.

Line 
1'''
2Created on 15 Dec 2009
3
4@author: pnorton
5'''
6import logging
7import math
8import os
9import numpy
10from linplot import Plot
11from linplot_tests.draw import getDrawOutputDir, SHORT_LOG_FORMAT_STRING
12
13def draw_data(s=None):
14   
15    fileName = 'data.png'
16    outputDir = getDrawOutputDir()
17    outputFile = os.path.join(outputDir, fileName)
18       
19    ydata = numpy.array([325.0, 325.0, 325.0, 325.0])
20    xdata = numpy.array([1990.0, 2000.0, 2020.0, 2040.0])
21   
22    plt = Plot()
23    plt.draw(xdata, ydata)
24   
25    plt.setXLabel('X - year')
26    plt.setYLabel('Y - temp')
27       
28    plt.saveImage(outputFile)
29    print "Wrote %s" % (outputFile)
30   
31if __name__ == '__main__':
32   
33    logging.basicConfig(level=logging.DEBUG, format=SHORT_LOG_FORMAT_STRING)
34    draw_data()
Note: See TracBrowser for help on using the repository browser.