Skip to content

Commit

Permalink
Can include date & time in plot title
Browse files Browse the repository at this point in the history
This was requested in issue #28. It may not do everything that was
wanted, but it is better than nothing.

Signed-off-by: Jim Easterbrook <jim@jim-easterbrook.me.uk>
  • Loading branch information
jim-easterbrook committed Jun 16, 2015
1 parent 0c54680 commit c4a64b5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 12 deletions.
9 changes: 9 additions & 0 deletions src/pywws/Plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@
``<title>Today's weather</title>``. This title appears at the very top
of the graph, outside any plot area.
.. versionadded:: 15.06.0.dev1301
If the title contains any "%%" characters it will be used as a
strftime style format string for the datetime of the stop value. This
allows you to include the graph's date or time in the title.
subplot
^^^^^^^
Expand Down Expand Up @@ -608,6 +613,10 @@ def DoPlot(self, input_file, output_file):
if title:
if sys.version_info[0] < 3:
title = title.encode(self.encoding)
if '%' in title:
x_hi = (self.x_hi -
self.utcoffset).replace(tzinfo=utc).astimezone(Local)
title = x_hi.strftime(title)
title = 'title "%s"' % title
of.write('set multiplot layout %d, %d %s\n' % (self.rows, self.cols, title))
# do actual plots
Expand Down
24 changes: 15 additions & 9 deletions src/pywws/WindRose.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# pywws - Python software for USB Wireless Weather Stations
# http://github.com/jim-easterbrook/pywws
# Copyright (C) 2008-14 Jim Easterbrook jim@jim-easterbrook.me.uk
# Copyright (C) 2008-15 pywws contributors

# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
Expand Down Expand Up @@ -80,12 +80,6 @@
This is the root element of the graph XML file. It does not have to be
called "graph", but there must be exactly one root element.
windrose
^^^^^^^^
A separate plot is drawn for each windrose element, but all share the
same time period.
start
^^^^^
Expand Down Expand Up @@ -148,10 +142,22 @@
title
^^^^^
Sets the overall title of the plots. A single line of text, for
example: ``<title>Today's weather</title>``. This title appears at the
Sets the overall title of the plots. A single line of text, for example:
``<title>Today's wind direction</title>``. This title appears at the
very top, outside any plot area.
.. versionadded:: 15.06.0.dev1301
If the title contains any "%%" characters it will be used as a
strftime style format string for the datetime of the stop value. This
allows you to include the graph's date or time in the title, for
example: ``<title>Wind over 24 hours ending %%H:%%M (mph)</title>``
windrose
^^^^^^^^
A separate plot is drawn for each windrose element, but all share the
same time period.
xcalc
^^^^^
Expand Down
6 changes: 3 additions & 3 deletions src/pywws/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '15.06.0.dev1300'
_release = '1300'
_commit = '744a4ff'
__version__ = '15.06.0.dev1301'
_release = '1301'
_commit = '0c54680'

0 comments on commit c4a64b5

Please sign in to comment.