MCPcopy Create free account
hub / github.com/danjgale/surfplot / _set_label_positions

Function _set_label_positions

surfplot/plotting.py:134–150  ·  view source on GitHub ↗

Get rotation, horizontal alignment, and vertical alignment, respectively, based on orientation and rotation

(location, rotation)

Source from the content-addressed store, hash-verified

132
133
134def _set_label_positions(location, rotation):
135 """Get rotation, horizontal alignment, and vertical alignment,
136 respectively, based on orientation and rotation
137 """
138 if location in ['top', 'bottom']:
139 rotation = 'horizontal' if rotation is None else rotation
140 return rotation, 'right', 'center'
141
142 elif location in ['left', 'right']:
143 rotation = 90 if rotation is None else rotation
144 if rotation == 90 or rotation == 0:
145 return rotation, 'center', 'bottom'
146 else:
147 return rotation, 'left', 'bottom'
148 else:
149 raise ValueError("`location` must be 'top', 'bottom', 'left' or "
150 "'right'")
151
152
153def _set_colorbar_labels(cbar, label, location, fontsize=10, rotation=None):

Callers 1

_set_colorbar_labelsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected