File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 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):
203203 ax : matplotlib.axes
204204 The mapping of the axis metadata and the scale data
205205 """
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
206224 if channel .type == 'temporal' and channel .name == 'x' :
207225 for label in ax .get_xticklabels ():
208226 # Rotate the labels on the x-axis so they don't run into each other.
209227 label .set_rotation (30 )
210228 label .set_ha ('right' )
229+
211230
212231def _set_axis_title (channel , ax ):
213232 '''Sets the axis label
You can’t perform that action at this time.
0 commit comments