Defines the GridMapper class, which maps from a 2-D region in data space into a structured (gridded) 1-D output space.
GridMapper(x_type='linear', y_type='linear', range=None, **kwargs)¶
Maps a 2-D data space to and from screen space by specifying a 2-tuple in data space or by specifying a pair of screen coordinates.
The mapper concerns itself only with metric and not with orientation. So, to “flip” a screen space orientation, swap the appropriate screen space values for x_low_pos, x_high_pos, y_low_pos, and y_high_pos.
The aspect ratio that we wish to maintain
Should the mapper try to maintain a fixed aspect ratio between x and y
map_data(screen_pts) → data_vals¶
Maps values from screen space into data space.
map_data_array(screen_vals) → data_vals¶
Maps an array of values from screen space into data space. By default, this method just loops over the points, calling map_data() on each one. For vectorizable mapping functions, override this implmentation with a faster one.
map_screen(data_pts) → screen_array¶
Maps values from data space into screen space.
The data-space bounds of the mapper.
Convenience property for low and high positions in one structure. Must be a tuple (x_low_pos, x_high_pos, y_low_pos, y_high_pos).
stretch_data_x= DelegatesTo("_xmapper", prefix="stretch_data")¶
Should the mapper stretch the dataspace when its screen space bounds are modified (default), or should it preserve the screen-to-data ratio and resize the data bounds? If the latter, it will only try to preserve the ratio if both screen and data space extents are non-zero.
The screen space position of the upper bound of the horizontal axis.
The screen space position of the lower bound of the horizontal axis.
The screen space position of the upper bound of the vertical axis.
The screen space position of the lower bound of the vertical axis.