11import numpy as np
22from matplotlib import pyplot as plt
33
4- def _handle_x (ax , spec ):
4+ def _set_title (ax , enc , spec ):
5+ title = spec .get ('title' )
6+ aggregate = spec .get ('aggregate' )
7+ bin = spec .get ('bin' )
8+ timeUnit = spec .get ('timeUnit' )
9+
10+ if title :
11+ if enc == 'x' :
12+ ax .set_xlabel (title )
13+ elif enc == 'y' :
14+ ax .set_ylabel (title )
15+ elif aggregate :
16+ raise NotImplementedError
17+ elif bin :
18+ raise NotImplementedError
19+ elif timeUnit :
20+ raise NotImplementedError
21+
22+ def _set_ticks (ax , enc , spec ):
523 pass
624
7- def _handle_y (ax , spec ):
25+ def _set_locators (ax , enc , spec ):
826 pass
927
1028def convert_axis (ax , chart ):
@@ -22,11 +40,8 @@ def convert_axis(ax, chart):
2240
2341 """
2442
25- _AXIS_HANDLER_MAPPING = {
26- 'x' : _handle_x ,
27- 'y' : _handle_y ,
28- }
29-
3043 for enc_channel , enc_spec in chart .to_dict ['encoding' ]:
3144 if enc_channel in ['x' , 'y' ]:
32- _AXIS_HANDLER_MAPPING [enc_channel ](ax , enc_spec )
45+ _set_title (ax , enc_channel , enc_spec )
46+ _set_ticks (ax , enc_channel , enc_spec )
47+ _set_locators (ax , enc_channel , enc_spec )
0 commit comments