Skip to content

Commit f8add24

Browse files
committed
Adds axis.labels functionality
1 parent fb0c0e1 commit f8add24

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

mplaltair/_axis.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,22 @@ def _set_axis_title(channel, ax):
233233
elif channel.timeUnit:
234234
raise NotImplementedError
235235

236+
def _set_axis_label_visibility(channel, ax):
237+
'''Set the axis label visibility
238+
239+
Parameters
240+
----------
241+
channel: parse_chart.ChannelMetadata
242+
The channel data and metadata
243+
ax: maptlotlib.axes
244+
The matplotlib axis to be modified
245+
'''
246+
labels = channel.axis.get('labels', True)
247+
248+
if channel.name == 'x':
249+
ax.tick_param(labelbottom=labels, labeltop=labels)
250+
elif channel.name == 'y':
251+
ax.tick_param(labelleft=labels, labelright=labels)
236252

237253
def convert_axis(ax, chart):
238254
"""Convert elements of the altair chart to Matplotlib axis properties
@@ -251,3 +267,4 @@ def convert_axis(ax, chart):
251267
_set_tick_formatter(channel, ax)
252268
_set_label_angle(channel, ax)
253269
_set_axis_title(channel, ax)
270+
_set_axis_label_visibility(channel, ax)

0 commit comments

Comments
 (0)