ipyoverlay.utils.convert_mpl_data_to_pixel#
- ipyoverlay.utils.convert_mpl_data_to_pixel(axis, data_x, data_y, truncate=True)#
Given a data location in a matplotlib axis, return the corresponding location in pixels from left/top.
NOTE: these pixel outputs are relative to the matplotlib canvas element. This means if there are elements above/to the left of the graph, the outputs will need to be adjusted
- Parameters:
axis (Axes) – The matplotlib axis to get the pixel location relative to.
data_x (float) – X-axis value.
data_y (float) – Y-axis value.
truncate (bool) – Whether to return -1, -1 if outside the axis limits or not.
- Return type:
tuple[float, float]