def setup_rot_axes(fig, rect): tr = Affine2D().rotate_deg(90.0) grid_helper = gh.GridHelperCurveLinear(tr) ax1 = SubplotHost(fig, rect, grid_helper=grid_helper) fig.add_subplot(ax1) ax2 = ParasiteAxesAuxTrans(ax1, tr, "equal") ax1.set_ylim([end, start]) ax1.set_xlim([-8, 4]) ax2 = ax1.get_aux_axes(tr) ax1.set_aspect('auto') ax1.axis['top', 'right', 'left', 'bottom'].set_visible(False) return ax1, ax2
def axesTop(fig, rect, ternaryinfo, grid=False, debug=False): xname = ternaryinfo.right.name vminx, vmaxx = ternaryinfo.right.max, ternaryinfo.right.min yname = ternaryinfo.top.name vminy, vmaxy = ternaryinfo.top.min, ternaryinfo.top.max ox = vminx oy = vminy sx = float(vmaxx - vminx) sy = float(vmaxy - vminy) M = plttransforms.Affine2D() M += plttransforms.Affine2D().translate(-ox, -oy) M += plttransforms.Affine2D().scale(1, sx / sy) M += plttransforms.Affine2D().skew_deg(15, 15) M += plttransforms.Affine2D().rotate_deg(-15) f, fi = transformations(M) grid_helper = pltahelper.GridHelperCurveLinear((f, fi)) ax = plta.Axes(fig, rect, grid_helper=grid_helper, frameon=False) ax.axis["top", "right", "left", "bottom"].set_visible(False) ax.axis["Y"] = ax.new_floating_axis(0, ox) ax.axis["Y"].label.set_text(yname) ax.axis["Y"].label.set_color(ternaryinfo.top.color) xmax1, ymin1 = f(vminx, vminy) xmax1, ymin1 = xmax1[0], ymin1[0] xmin1, _ = f(vmaxx, vminy) xmin1 = xmin1[0] _, ymax1 = f(vminx, vmaxy) ymax1 = ymax1[0] ax.set_xlim(xmin1, xmax1) ax.set_ylim(ymin1, ymax1) if debug: ax.axis["X"] = ax.new_floating_axis(1, oy) ax.axis["X"].label.set_text(xname) ax.plot(*f([vminx, vmaxx], [vminy, vminy]), marker="o", markersize=10) ax.plot(*f([vminx, vminx], [vminy, vmaxy]), marker="+", markersize=10) if grid: ax.grid(True, axis="y", zorder=0, color=ternaryinfo.top.color) return ax