def _apply_transformations(plot_config, data_slice):
"""Rotate, flip and zoom the data slice.
Depending on the plot configuration, this will apply some transformations to the given data slice.
Args:
plot_config (mdt.visualization.maps.base.MapPlotConfig): the plot configuration
data_slice (ndarray): the 2d slice of data to transform
Returns:
ndarray: the transformed 2d slice of data
"""
if plot_config.rotate:
data_slice = np.rot90(data_slice, plot_config.rotate // 90)
if not plot_config.flipud:
# by default we flipud to correct for matplotlib lower origin. If the user
# sets flipud, we do not need to to it
data_slice = np.flipud(data_slice)
data_slice = plot_config.zoom.apply(data_slice)
return data_slice
评论列表
文章目录