@@ -35,29 +35,22 @@ def _set_limits(channel, scale):
3535 # Check that a positive minimum is zero if zero is True:
3636 if ('zero' not in scale or scale ['zero' ] == True ) and min (channel ['data' ]) > 0 :
3737 lims [_axis_kwargs [channel ['axis' ]].get ('min' )] = 0 # quantitative sets min to be 0 by default
38- else :
39- pass # use default
4038
4139 # Check that a negative maximum is zero if zero is True:
4240 if ('zero' not in scale or scale ['zero' ] == True ) and max (channel ['data' ]) < 0 :
4341 lims [_axis_kwargs [channel ['axis' ]].get ('max' )] = 0
44- else :
45- pass # use default
4642
4743 elif channel ['dtype' ] == 'temporal' :
44+ # determine limits
4845 if 'domain' in scale :
49- try :
50- domain = _convert_to_mpl_date (scale ['domain' ])
51- except NotImplementedError :
52- raise NotImplementedError
46+ domain = _convert_to_mpl_date (scale ['domain' ])
5347 lims [_axis_kwargs [channel ['axis' ]].get ('min' )] = domain [0 ]
5448 lims [_axis_kwargs [channel ['axis' ]].get ('max' )] = domain [1 ]
5549 elif 'type' in scale and scale ['type' ] != 'time' :
5650 lims = _set_scale_type (channel , scale )
57- else :
58- pass # use default
51+
5952 else :
60- raise NotImplementedError
53+ raise NotImplementedError # Ordinal and Nominal go here?
6154
6255 # set the limits
6356 if channel ['axis' ] == 'x' :
@@ -116,6 +109,7 @@ def _set_scale_type(channel, scale):
116109def _set_tick_locator (channel , axis ):
117110 """Set the tick locator if it needs to vary from the default"""
118111 # Works for quantitative and temporal
112+ # The auto locator has similar (if not the same) defaults as Altair
119113 current_axis = {'x' : channel ['ax' ].xaxis , 'y' : channel ['ax' ].yaxis }
120114 if 'values' in axis :
121115 if channel ['dtype' ] == 'temporal' :
@@ -128,8 +122,6 @@ def _set_tick_locator(channel, axis):
128122 current_axis [channel ['axis' ]].set_major_locator (
129123 ticker .MaxNLocator (steps = [2 , 5 , 10 ], nbins = axis .get ('tickCount' )+ 1 , min_n_ticks = axis .get ('tickCount' ))
130124 )
131- else :
132- pass # Use the auto locator (it has similar, if not the same settings as Altair)
133125
134126
135127def _set_tick_formatter (channel , axis ):
@@ -150,7 +142,7 @@ def _set_tick_formatter(channel, axis):
150142 except ValueError :
151143 raise ValueError ("Matplotlib only supports `strftime` formatting for dates."
152144 "Currently, %L, %Q, and %s are allowed in Altair, but not allowed in Matplotlib."
153- "Please use a :func: `strftime` compliant format string." )
145+ "Please use a `strftime` compliant format string." )
154146
155147
156148 # TODO: move rotation to another function?
@@ -171,11 +163,8 @@ def _set_tick_formatter(channel, axis):
171163 raise ValueError ("Matplotlib only supports format strings as used by `str.format()`."
172164 "Some format strings that work in Altair may not work in Matplotlib."
173165 "Please use a different format string." )
174- else :
175- # Use the default formatter for quantitative (it has similar, if not the same settings as Altair)
176- pass
177166 else :
178- pass
167+ raise NotImplementedError # Nominal and Ordinal go here
179168
180169
181170def convert_axis (ax , chart ):
0 commit comments