@@ -226,7 +226,6 @@ def _set_label_angle(channel, ax):
226
226
# Rotate the labels on the x-axis so they don't run into each other.
227
227
label .set_rotation (30 )
228
228
label .set_ha ('right' )
229
-
230
229
231
230
def _set_axis_title (channel , ax ):
232
231
'''Sets the axis label
@@ -269,6 +268,37 @@ def _set_axis_label_visibility(channel, ax):
269
268
elif channel .name == 'y' :
270
269
ax .tick_param (labelleft = labels , labelright = labels )
271
270
271
+ def _set_axis_orientation (channel , ax ):
272
+ '''Set the axis orientation
273
+
274
+ Parameters
275
+ ----------
276
+ channel: parse_chart.ChannelMetadata
277
+ The channel data and metadata
278
+ ax: maptlotlib.axes
279
+ The matplotlib axis to be modified
280
+ '''
281
+ orient = channel .axis .get ('orient' )
282
+
283
+ if orient is None :
284
+ if channel .name == 'x' :
285
+ orient = 'bottom'
286
+ elif channel .name == 'y' :
287
+ orient = 'left'
288
+
289
+ ACTIONS = {
290
+ 'x' : {
291
+ 'top' : ax .xaxis .tick_top ,
292
+ 'bottom' : ax .xaxis .tick_bottom
293
+ },
294
+ 'y' : {
295
+ 'left' : ax .xaxis .tick_left ,
296
+ 'right' : ax .xaxis .tick_right
297
+ }
298
+ }
299
+
300
+ ACTIONS [enc ][orient ]()
301
+
272
302
def convert_axis (ax , chart ):
273
303
"""Convert elements of the altair chart to Matplotlib axis properties
274
304
@@ -287,3 +317,4 @@ def convert_axis(ax, chart):
287
317
_set_label_angle (channel , ax )
288
318
_set_axis_title (channel , ax )
289
319
_set_axis_label_visibility (channel , ax )
320
+ _set_axis_orientation (channel , ax )
0 commit comments