From cbb7abc459c9a3eb99154a749184bc1883b702f6 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Thu, 24 Oct 2019 22:25:56 +0200 Subject: [PATCH] Cleanup axisartist tutorial. --- tutorials/toolkits/axisartist.py | 52 ++++++++++++++++---------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/tutorials/toolkits/axisartist.py b/tutorials/toolkits/axisartist.py index e07461c07e1f..eb89daf8393c 100644 --- a/tutorials/toolkits/axisartist.py +++ b/tutorials/toolkits/axisartist.py @@ -87,8 +87,7 @@ Or a fixed axis with some offset :: # make new (right-side) yaxis, but with some offset - ax.axis["right2"] = ax.new_fixed_axis(loc="right", - offset=(20, 0)) + ax.axis["right2"] = ax.new_fixed_axis(loc="right", offset=(20, 0)) axisartist with ParasiteAxes ---------------------------- @@ -262,17 +261,18 @@ To turn all on but (axis) label off :: - ax.axis["bottom"].toggle(all=True, label=False)) + ax.axis["bottom"].toggle(all=True, label=False) ax.axis's __getitem__ method can take multiple axis names. For example, to turn ticklabels of "top" and "right" axis on, :: - ax.axis["top","right"].toggle(ticklabels=True)) + ax.axis["top", "right"].toggle(ticklabels=True) -Note that 'ax.axis["top","right"]' returns a simple proxy object that translate above code to something like below. :: +Note that 'ax.axis["top", "right"]' returns a simple proxy object that +translate above code to something like below. :: - for n in ["top","right"]: - ax.axis[n].toggle(ticklabels=True)) + for n in ["top", "right"]: + ax.axis[n].toggle(ticklabels=True) So, any return values in the for loop are ignored. And you should not use it anything more than a simple method. @@ -301,7 +301,7 @@ 3. To change the attributes of multiple axis:: - ax.axis["left","bottom"].major_ticklabels.set_color("r") + ax.axis["left", "bottom"].major_ticklabels.set_color("r") or to change the attributes of all axis:: @@ -450,22 +450,22 @@ So, in summary, - * AxisArtist's methods - * set_axis_direction : "left", "right", "bottom", or "top" - * set_ticklabel_direction : "+" or "-" - * set_axislabel_direction : "+" or "-" - * invert_ticklabel_direction - * Ticks' methods (major_ticks and minor_ticks) - * set_tick_out : True or False - * set_ticksize : size in points - * TickLabels' methods (major_ticklabels and minor_ticklabels) - * set_axis_direction : "left", "right", "bottom", or "top" - * set_rotation : angle with respect to the reference direction - * set_ha and set_va : see below - * AxisLabels' methods (label) - * set_axis_direction : "left", "right", "bottom", or "top" - * set_rotation : angle with respect to the reference direction - * set_ha and set_va +* AxisArtist's methods + * set_axis_direction: "left", "right", "bottom", or "top" + * set_ticklabel_direction: "+" or "-" + * set_axislabel_direction: "+" or "-" + * invert_ticklabel_direction +* Ticks' methods (major_ticks and minor_ticks) + * set_tick_out: True or False + * set_ticksize: size in points +* TickLabels' methods (major_ticklabels and minor_ticklabels) + * set_axis_direction: "left", "right", "bottom", or "top" + * set_rotation: angle with respect to the reference direction + * set_ha and set_va: see below +* AxisLabels' methods (label) + * set_axis_direction: "left", "right", "bottom", or "top" + * set_rotation: angle with respect to the reference direction + * set_ha and set_va Adjusting ticklabels alignment ------------------------------ @@ -541,8 +541,8 @@ def inv_tr(x, y): # system in degree tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform() - # extreme finder : find a range of coordinate. - # 20, 20 : number of sampling points along x, y direction + # extreme finder: find a range of coordinate. + # 20, 20: number of sampling points along x, y direction # The first coordinate (longitude, but theta in polar) # has a cycle of 360 degree. # The second coordinate (latitude, but radius in polar) has a minimum of 0