Skip to content

Commit 9bbaa00

Browse files
committed
Adds axis boilerplate
1 parent 7a6f383 commit 9bbaa00

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

mplaltair/_axis.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import numpy as np
2+
from matplotlib import pyplot as plt
3+
4+
def _handle_x(ax, spec):
5+
pass
6+
7+
def _handle_y(ax, spec):
8+
pass
9+
10+
def convert_axis(ax, chart):
11+
"""Convert elements of the altair chart to Matplotlib axis properties
12+
13+
Parameters
14+
----------
15+
ax
16+
The Matplotlib axis to be modified
17+
chart
18+
The Altair chart
19+
20+
Raises
21+
------
22+
23+
"""
24+
25+
_AXIS_HANDLER_MAPPING = {
26+
'x': _handle_x,
27+
'y': _handle_y,
28+
}
29+
30+
for enc_channel, enc_spec in chart.to_dict['encoding']:
31+
if enc_channel in ['x', 'y']:
32+
_AXIS_HANDLER_MAPPING[enc_channel](ax, enc_spec)

0 commit comments

Comments
 (0)