def _encode_fields(self, xfield, yfield, time_unit=None,<EOL>scale=Scale(zero=False)):
if scale is None:<EOL><INDENT>scale = Scale()<EOL><DEDENT>xfieldtype = xfield[<NUM_LIT:1>]<EOL>yfieldtype = yfield[<NUM_LIT:1>]<EOL>x_options = None<EOL>if len(xfield) > <NUM_LIT:2>:<EOL><INDENT>x_options = xfield[<NUM_LIT:2>]<EOL><DEDENT>y_options = None<EOL>if len(yfield) > <NUM_LIT:2>:<EOL><INDENT>y_options = yfield[<NUM_LIT:2>]<EOL><DEDENT>if time_unit is not None:<EOL><INDENT>if x_options is None:<EOL><INDENT>xencode = X(xfieldtype, timeUnit=time_unit)<EOL><DEDENT>else:<EOL><INDENT>xencode = X(<EOL>xfieldtype,<EOL>axis=Axis(**x_options),<EOL>timeUnit=time_unit,<EOL>scale=scale<EOL>)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if x_options is None:<EOL><INDENT>xencode = X(xfieldtype)<EOL><DEDENT>else:<EOL><INDENT>xencode = X(<EOL>xfieldtype,<EOL>axis=Axis(**x_options),<EOL>scale=scale<EOL>)<EOL><DEDENT><DEDENT>if y_options is None:<EOL><INDENT>yencode = Y(yfieldtype, scale=scale)<EOL><DEDENT>else:<EOL><INDENT>yencode = Y(<EOL>yfieldtype,<EOL>axis=Axis(**y_options),<EOL>scale=scale<EOL>)<EOL><DEDENT>return xencode, yencode<EOL>
Encode the fields in Altair format