Sometimes, things like axis_direction need to be adjusted.
(fig, rect)
| 85 | |
| 86 | |
| 87 | def setup_axes3(fig, rect): |
| 88 | """ |
| 89 | Sometimes, things like axis_direction need to be adjusted. |
| 90 | """ |
| 91 | |
| 92 | tr_rotate = Affine2D().translate(-95, 0) # rotate a bit for better orientation |
| 93 | tr_scale = Affine2D().scale(np.pi/180., 1.) # scale degree to radians |
| 94 | tr = tr_rotate + tr_scale + PolarAxes.PolarTransform() |
| 95 | |
| 96 | # Specify theta limits in degrees |
| 97 | ra0, ra1 = 8.*15, 14.*15 |
| 98 | # Specify radial limits |
| 99 | cz0, cz1 = 0, 14000 |
| 100 | |
| 101 | grid_helper = floating_axes.GridHelperCurveLinear( |
| 102 | tr, extremes=(ra0, ra1, cz0, cz1), |
| 103 | grid_locator1=angle_helper.LocatorHMS(4), |
| 104 | tick_formatter1=angle_helper.FormatterHMS(), |
| 105 | grid_locator2=MaxNLocator(3), |
| 106 | tick_formatter2=None, |
| 107 | ) |
| 108 | ax1 = fig.add_subplot( |
| 109 | rect, axes_class=floating_axes.FloatingAxes, grid_helper=grid_helper) |
| 110 | |
| 111 | # adjust axis |
| 112 | ax1.axis["left"].set_axis_direction("bottom") |
| 113 | ax1.axis["right"].set_axis_direction("top") |
| 114 | |
| 115 | ax1.axis["bottom"].set_visible(False) |
| 116 | ax1.axis["top"].set_axis_direction("bottom") |
| 117 | ax1.axis["top"].toggle(ticklabels=True, label=True) |
| 118 | ax1.axis["top"].major_ticklabels.set_axis_direction("top") |
| 119 | ax1.axis["top"].label.set_axis_direction("top") |
| 120 | |
| 121 | ax1.axis["left"].label.set_text(r"cz [km$^{-1}$]") |
| 122 | ax1.axis["top"].label.set_text(r"$\alpha_{1950}$") |
| 123 | ax1.grid() |
| 124 | |
| 125 | # create a parasite Axes whose transData in RA, cz |
| 126 | aux_ax = ax1.get_aux_axes(tr) |
| 127 | |
| 128 | aux_ax.patch = ax1.patch # for aux_ax to have a clip path as in ax |
| 129 | ax1.patch.zorder = 0.9 # but this has a side effect that the patch is |
| 130 | # drawn twice, and possibly over some other |
| 131 | # artists. So, we decrease the zorder a bit to |
| 132 | # prevent this. |
| 133 | |
| 134 | return ax1, aux_ax |
| 135 | |
| 136 | |
| 137 | # %% |
no test coverage detected
searching dependent graphs…