@@ -16,8 +16,8 @@ def _set_limits(channel, scale):
1616 """
1717
1818 _axis_kwargs = {
19- 'x' : {'min' : 'xmin ' , 'max' : 'xmax ' },
20- 'y' : {'min' : 'ymin ' , 'max' : 'ymax ' },
19+ 'x' : {'min' : 'left ' , 'max' : 'right ' },
20+ 'y' : {'min' : 'bottom ' , 'max' : 'top ' },
2121 }
2222
2323 lims = {}
@@ -87,11 +87,11 @@ def _set_scale_type(channel, scale):
8787 if channel ['axis' ] == 'x' :
8888 channel ['ax' ].set_xscale ('log' , basex = base )
8989 # lower limit: round down to nearest major tick (using log base change rule)
90- lims ['xmin ' ] = base ** np .floor (np .log10 (channel ['data' ].min ())/ np .log10 (base ))
90+ lims ['left ' ] = base ** np .floor (np .log10 (channel ['data' ].min ())/ np .log10 (base ))
9191 else : # y-axis
9292 channel ['ax' ].set_yscale ('log' , basey = base )
9393 # lower limit: round down to nearest major tick (using log base change rule)
94- lims ['ymin ' ] = base ** np .floor (np .log10 (channel ['data' ].min ())/ np .log10 (base ))
94+ lims ['bottom ' ] = base ** np .floor (np .log10 (channel ['data' ].min ())/ np .log10 (base ))
9595
9696 elif scale ['type' ] == 'pow' or scale ['type' ] == 'sqrt' :
9797 """The 'sqrt' scale is just the 'pow' scale with exponent = 0.5.
@@ -144,14 +144,23 @@ def _set_tick_locator(channel, axis):
144144
145145
146146def _set_tick_formatter (channel , axis ):
147- """Set the tick formatter
147+ """Set the tick formatter.
148+
148149
149150 Parameters
150151 ----------
151152 channel : dict
152153 The mapping of the channel data and metadata
153154 axis : dict
154155 The mapping of the axis metadata and the scale data
156+
157+ Notes
158+ -----
159+ For quantitative formatting, Matplotlib does not support some format strings that Altair supports.
160+ Matplotlib only supports format strings as used by str.format().
161+
162+ For formatting of temporal data, Matplotlib does not support some format strings that Altair supports (%L, %Q, %s).
163+ Matplotlib only supports datetime.strftime formatting for dates.
155164 """
156165 current_axis = {'x' : channel ['ax' ].xaxis , 'y' : channel ['ax' ].yaxis }
157166 format_str = ''
@@ -163,14 +172,7 @@ def _set_tick_formatter(channel, axis):
163172 if not format_str :
164173 format_str = '%b %d, %Y'
165174
166- current_axis [channel ['axis' ]].set_major_formatter (mdates .DateFormatter (format_str ))
167-
168- try :
169- current_axis [channel ['axis' ]].get_major_formatter ().__call__ (1 )
170- except ValueError :
171- raise ValueError ("Matplotlib only supports `strftime` formatting for dates."
172- "Currently, %L, %Q, and %s are allowed in Altair, but not allowed in Matplotlib."
173- "Please use a `strftime` compliant format string." )
175+ current_axis [channel ['axis' ]].set_major_formatter (mdates .DateFormatter (format_str )) # May fail silently
174176
175177 elif channel ['dtype' ] == 'quantitative' :
176178 if format_str :
0 commit comments