My question is quite simple: In matplotlib, how can I easily convert from data system to / from data system in Axis system (ideally I really have my exact problem: I have a
matplotlib.patches I want to plot the .lipse
/ code> with its center in the Axis system but its size (width and length) in the data system.
transforms.blended_transform_factory
method does not work in this case .
Regrettably!
No immediate solution was found, it has to be written by itself:
< Pre>
def axis-data_cords_sys_transform (axis_obj_in, xin, yin, inverse = false): "" "reverse = false: axis => data = true: data => axis" "xim = axis_obj_in.get_xlim () Ylim = axis_obj_in.get_ylim () xdelta = xlim [1] - Exclamation [0] ydelta = ylim [1] - Ylim [0] If the inverse is not: xout = xlim [0] + xin * xdelta yout = ylim [ 0] + yin * ydelta else: xdelta2 = xin - xlim [0] ydelta2 = yin - ylim [0] xout = xdelta2 / Xdelta yout = ydelta2 / ydelta return xout, yout