File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,17 @@ New entries should be added at the top
22
33==============================================================
44
5+ 2004-09-17 Added coords formatter attributes. These must be callable,
6+ and return a string for the x or y data. These will be used
7+ to format the x and y data for the coords box. Default is
8+ the axis major formatter. Eg
9+
10+ # format the coords message box
11+ def price(x): return '$%1.2f'%x
12+ ax.format_xdata = DateFormatter('%Y-%m-%d')
13+ ax.format_ydata = price
14+
15+
5162004-09-17 Total rewrite of dates handling to use python datetime with
617 num2date, date2num and drange. pytz for timezone handling,
718 dateutils for spohisticated ticking. date ranges from
Original file line number Diff line number Diff line change @@ -577,6 +577,7 @@ ZeroDivisionError: SeparableTransformation::eval_scalars yin interval is zero; c
577577
578578-- colorbar for dynamic images.
579579
580- -- Finish the coords notification for all backends
580+ -- Finish the coords notification for all backends - allow custom
581+ formatters for toolbar
581582
582- -- ro an rrulewrapper demo
583+ -- DONE an rrulewrapper demo
Original file line number Diff line number Diff line change 2525months = MonthLocator () # every month
2626yearsFmt = DateFormatter ('%Y' )
2727
28-
2928quotes = quotes_historical_yahoo (
3029 'INTC' , date1 , date2 )
3130if not quotes :
3736ax = subplot (111 )
3837plot_date (dates , opens )
3938
39+ # format the ticks
4040ax .xaxis .set_major_locator (years )
4141ax .xaxis .set_major_formatter (yearsFmt )
4242ax .xaxis .set_minor_locator (months )
4343ax .autoscale_view ()
44+
45+ # format the coords message box
46+ def price (x ): return '$%1.2f' % x
47+ ax .format_xdata = DateFormatter ('%Y-%m-%d' )
48+ ax .format_ydata = price
49+
4450grid (True )
4551show ()
Original file line number Diff line number Diff line change 44formatters. See major_minor_demo1.py for more information on
55controlling major and minor ticks
66"""
7-
7+ import datetime
88from matplotlib .matlab import *
99from matplotlib .dates import MONDAY , SATURDAY
1010from matplotlib .finance import quotes_historical_yahoo
1616
1717mondays = WeekdayLocator (MONDAY ) # every monday
1818months = MonthLocator (range (1 ,13 ), bymonthday = 1 ) # every month
19- monthsFmt = DateFormatter ('%b %d' )
19+ monthsFmt = DateFormatter ('%b %d' )
2020
2121
2222quotes = quotes_historical_yahoo ('INTC' , date1 , date2 )
Original file line number Diff line number Diff line change 9898except ImportError :
9999 packages .append ('dateutil' )
100100
101+ packages .append ('dateutil' )
102+
101103try : import pytz
102104except ImportError :
103105 packages .append ('pytz' )
You can’t perform that action at this time.
0 commit comments