File tree 1 file changed +19
-0
lines changed 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -203,11 +203,30 @@ def _set_label_angle(channel, ax):
203
203
ax : matplotlib.axes
204
204
The mapping of the axis metadata and the scale data
205
205
"""
206
+
207
+ label_angle = channel .axis .get ('labelAngle' )
208
+
209
+ # Sets the defaults used by altair if axis.labelAngle is not specified
210
+ if label_angle is None :
211
+ if channel .type in ['ordinal' , 'nominal' ]:
212
+ label_angle = - 90
213
+ elif channel_type in ['quantitative' , 'temporal' ]:
214
+ label_angle = 0
215
+
216
+ if channel .name == 'x' :
217
+ for label in ax .get_xticklabels ():
218
+ label .set_rotation (- 1 * label_angle )
219
+ elif channel .name == 'y' :
220
+ for label in ax .get_yticklabels ():
221
+ label .set_rotation (- 1 * label_angle )
222
+
223
+ # Special case for temporal encoding type to improve visual appeal
206
224
if channel .type == 'temporal' and channel .name == 'x' :
207
225
for label in ax .get_xticklabels ():
208
226
# Rotate the labels on the x-axis so they don't run into each other.
209
227
label .set_rotation (30 )
210
228
label .set_ha ('right' )
229
+
211
230
212
231
def _set_axis_title (channel , ax ):
213
232
'''Sets the axis label
You can’t perform that action at this time.
0 commit comments