图;
h_axis =次要情节(1 1 1);
x_ax = [0.3, 0.5];
y_ax = [0.5, 0.5];
h_arrow_axis =注释(“箭头”x_ax y_ax,“颜色”, (1,0,0));
集(h_arrow_axis,“父”, h_axis);
x_fig = [0.7, 0.5];
y_fig = [0.5, 0.5];
[x_t, y_t] = transform_coordinates (h_axis、x_fig y_fig);
h_arrow_figure =注释(“箭头”x_t y_t,“颜色”[0, 0, 1]);
p =锅;
p.ActionPostCallback = {@pan_zoom_callback_update_arrow, h_axis、h_arrow_figure x_fig, y_fig};
z =放大;
z.ActionPostCallback = {@pan_zoom_callback_update_arrow, h_axis、h_arrow_figure x_fig, y_fig};
函数pan_zoom_callback_update_arrow (~, ~, axis_handle arrow_handle, x, y)
[x_t, y_t] = transform_coordinates (axis_handle, x, y);
arrow_handle。X = x_t;
arrow_handle。Y = y_t;
结束
函数[xaf, yaf] = transform_coordinates (h_axis, x, y)
axun =得到(h_axis,“单位”);
集(h_axis,“单位”,“归一化”);
axpos =得到(h_axis,“位置”);
axlim =轴(h_axis);
axwidth = diff (axlim (1:2));
axheight = diff (axlim (3:4));
Xaf = (x-axlim(1))*axpos(3)/axwidth + axpos(1);
Yaf = (y-axlim(3))*axpos(4)/axheight + axpos(2);
集(h_axis,“单位”axun)
结束