return z_matrix;
}
+pair ScaleInv(picture pic=currentpicture, pair z)
+{
+ return (pic.scale.x.Tinv(z.x),pic.scale.y.Tinv(z.y));
+}
+
void graphMatrixFile(picture pic=currentpicture, string file="datafile",
int xcol=0, int ycol=1, int zcol=2,
real xscale=1, real yscale=1,
xaxis(pic, x_label, BottomTop,LeftTicks,above=true);
if (y_label != null)
yaxis(pic, y_label, LeftRight,RightTicks,above=true);
- transform graph_to_pic = pic.calculateTransform();
- transform pic_to_graph = inverse(graph_to_pic);
- pair p_SE_pic = graph_to_pic * (xscale*max(xs), yscale*min(ys));
- pair p_initial_graph = pic_to_graph * (p_SE_pic + palette_offset*E);
- pair p_NE_pic = graph_to_pic * (xscale*max(xs), yscale*max(ys));
- pair p_final_graph = pic_to_graph * (p_NE_pic
- + (palette_offset+palette_width)*E);
+ transform pic_to_frame = pic.calculateTransform();
+ transform frame_to_pic = inverse(pic_to_frame);
+ pair lower_right_graph = (final.x, initial.y);
+ pair lower_right_pic = Scale(lower_right_graph);
+ pair lower_right_frame = pic_to_frame * lower_right_pic;
+ pair p_initial_frame = lower_right_frame + palette_offset * E;
+ pair p_initial_pic = frame_to_pic * p_initial_frame;
+ pair p_initial_graph = ScaleInv(p_initial_pic);
+ pair upper_right_graph = final;
+ pair upper_right_pic = Scale(upper_right_graph);
+ pair upper_right_frame = pic_to_frame * upper_right_pic;
+ pair p_final_frame = upper_right_frame + (palette_offset+palette_width) * E;
+ pair p_final_pic = frame_to_pic * p_final_frame;
+ pair p_final_graph = ScaleInv(p_final_pic);
if (palette_label == null)
palette(pic, bounds=range, initial=p_initial_graph, final=p_final_graph,
axis=Right, palette=p);