Skip to content

Commit

Permalink
Merge pull request #15 from TaskeHAMANO/feature/dplot
Browse files Browse the repository at this point in the history
Feature/dplot
  • Loading branch information
Shinya SUZUKI authored May 8, 2018
2 parents 65cbb69 + e1594bc commit 7aa3707
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
18 changes: 10 additions & 8 deletions sphere/sphere_dplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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)
Expand All @@ -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))
Expand Down
8 changes: 4 additions & 4 deletions tests/test_sphere_dplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 7aa3707

Please sign in to comment.