Skip to content

Commit

Permalink
Merge pull request #202 from autotwin/fix_fig
Browse files Browse the repository at this point in the history
Fix fig
  • Loading branch information
hovey authored Nov 13, 2024
2 parents aa2da9c + 84d77e3 commit f6cea8c
Show file tree
Hide file tree
Showing 7 changed files with 578 additions and 546 deletions.
26 changes: 21 additions & 5 deletions book/examples/sphere_with_shells/histogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,42 @@

# Generate some data
filenames = [
"res_2_iter_05.csv",
"res_3_iter_05.csv",
"res_4_iter_05.csv",
"~/scratch/ixi/IXI012-HH-1211-T1_large_s2.csv",
"~/scratch/ixi/IXI012-HH-1211-T1_large_s3.csv",
"~/scratch/ixi/IXI012-HH-1211-T1_large_s4.csv",
# "res_2_iter_05.csv",
# "res_3_iter_05.csv",
# "res_4_iter_05.csv",
]

for filename in filenames:

with open(filename, "r") as file:
with open(Path(filename).expanduser(), "r") as file:
data = file.read()

aa = data.strip().split("\n")
bb = [float(x) for x in aa]
print(f"Number of elements: {len(bb)}")
# n_neg = [x <= 0.0 for x in bb]

# breakpoint()
# Create the histogram
plt.hist(bb, bins=20, color='blue', alpha=0.7, log=True)

# Add labels and title
plt.xlabel("Minimum Scaled Jacobian (MSJ)")
plt.ylabel("Frequency")
plt.title(f"{filename}")
# plt.xticks(np.arange(-0.1, 1.0, 0.1))
xt = [-0.25, 0.0, 0.25, 0.5, 0.75, 1.00]
plt.xticks(xt)
plt.xlim([xt[0], xt[-1]])
plt.ylim([1, 2.0e6])

# x_ticks = list(range(nxp))
# y_ticks = list(range(nyp))
# z_ticks = list(range(nzp))

# ax.set_xlim(float(x_ticks[0]), float(x_ticks[-1]))

# Show the plot
# plt.show()
Expand Down
Loading

0 comments on commit f6cea8c

Please sign in to comment.