diff --git a/sphere/sphere_dplot.py b/sphere/sphere_dplot.py index d5ba78b..d40c1ed 100644 --- a/sphere/sphere_dplot.py +++ b/sphere/sphere_dplot.py @@ -24,12 +24,12 @@ def argument_parse(argv=None): parser.add_argument("output_dest", type=str, help="destination of output file") - parser.add_argument("-np", "--npetal", - dest="np", + parser.add_argument("-pn", "--petalnumber", + dest="pn", type=int, nargs="?", - default=30, - help="Number of petal in rose diagram (default: 30)") + default=50, + help="Petal number in rose diagram (default: 50)") parser.add_argument("-fs", "--fontsize", dest="fs", type=int, @@ -46,10 +46,12 @@ def main(args, logger): I = len(df) x = df.index.values y = df["depth"].values - t1 = np.arange(0, 2*np.pi, 2*np.pi/args["np"]) + pn = args["pn"] + + t1 = np.arange(0, 2*np.pi, 2*np.pi/pn) t2 = np.arange(0, 2*np.pi, 2*np.pi/I) - y_f = segment_depth(y, args["np"]) - width = 2 * np.pi / (args["np"]+10) + y_f = segment_depth(y, pn) + width = 2*np.pi / (pn+10) fig = plt.figure(figsize=(20, 20)) gs = gridspec.GridSpec(2, 2) @@ -61,7 +63,7 @@ def main(args, logger): ax1.tick_params(labelsize=fs) ax2 = fig.add_subplot(gs[1, 0], projection="polar") - ax2.bar(t1, y_f, width=width) + ax2.bar(t1, y_f, width=width, align="edge") ax2.set_theta_zero_location("N") ax2.set_xticks(np.arange(0, 360, 360/6) / 360 * 2 * np.pi) ax2.set_xticklabels(np.arange(0, I, I/6, dtype=int)) diff --git a/tests/test_sphere_dplot.py b/tests/test_sphere_dplot.py index 3a7ccc8..e49de88 100644 --- a/tests/test_sphere_dplot.py +++ b/tests/test_sphere_dplot.py @@ -28,7 +28,7 @@ def test_sphere_dplot_main_np5(self): args = { "depth_file_path": self.__input1, "output_dest": self.__output, - "np": 5, + "pn": 5, "fs": 30, } sphere_dplot.main(args, SphereDplotTest.logger) @@ -37,7 +37,7 @@ def test_sphere_dplot_main_np29(self): args = { "depth_file_path": self.__input1, "output_dest": self.__output, - "np": 29, + "pn": 29, "fs": 30, } sphere_dplot.main(args, SphereDplotTest.logger) @@ -46,7 +46,7 @@ def test_sphere_dplot_main_cl101(self): args = { "depth_file_path": self.__input1, "output_dest": self.__output, - "np": 10, + "pn": 10, "fs": 30, } sphere_dplot.main(args, SphereDplotTest.logger) @@ -58,7 +58,7 @@ def test_sphere_dplot_argument_parse(self): args_answer = { "depth_file_path": self.__input1, "output_dest": self.__output, - "np": 30, + "pn": 50, "fs": 30, } self.assertDictEqual(args, args_answer)