Skip to content
Snippets Groups Projects
Commit 3156784a authored by Saku Hakamaa's avatar Saku Hakamaa
Browse files

Merge branch 'code_fixes' into 'master'

Improve plot titles

See merge request !17
parents dcda26e8 f17b73ec
Branches
No related tags found
1 merge request!17Improve plot titles
Pipeline #6325 passed
......@@ -18,6 +18,7 @@
# ------------------------------
import ovito
# This user-defined function is called by OVITO to let it draw arbitrary graphics on top of the viewport.
# It is passed a QPainter (see http://qt-project.org/doc/qt-5/qpainter.html).
def render(painter, **args):
......
......@@ -89,8 +89,12 @@ def draw_figures(z_positions, dict_concs_mean, energy_list, frame_list, fig_rang
plt.ylim(-1, 101)
plt.grid()
plt.legend()
plt.title('Average concentrations from frame {start} to {end}'.format(start=profile_mean_range[0],
end=profile_mean_range[-1]))
if profile_mean_range[0] == profile_mean_range[-1]:
title_str = 'Concentrations at frame {frame}'.format(frame=profile_mean_range[0])
else:
title_str = 'Average concentrations from frame {start} to {end}'.format(start=profile_mean_range[0],
end=profile_mean_range[-1])
plt.title(title_str)
figure_mean.savefig(os.path.join(out_path, 'profile_mean.pdf'))
data_matrix = np.transpose(np.matrix(data_matrix))
np.savetxt(os.path.join(out_path, "profile_mean.txt"), data_matrix, header=' '.join(data_header), fmt='%.6f')
......@@ -103,8 +107,12 @@ def draw_figures(z_positions, dict_concs_mean, energy_list, frame_list, fig_rang
plt.ylim(-1, 101)
plt.grid()
plt.legend()
plt.title('Average concentrations from frame {start} to {end}'.format(start=profile_mean_range[0],
end=profile_mean_range[-1]))
if profile_mean_range[0] == profile_mean_range[-1]:
title_str = 'Filtered concentrations at frame {frame}'.format(frame=profile_mean_range[0])
else:
title_str = 'Filtered average concentrations from frame {start} to {end}'.format(start=profile_mean_range[0],
end=profile_mean_range[-1])
plt.title(title_str)
figure_mean_filtered.savefig(os.path.join(out_path, 'profile_mean_filtered.pdf'))
# ------------------------------
......@@ -147,8 +155,11 @@ def draw_figures(z_positions, dict_concs_mean, energy_list, frame_list, fig_rang
def update(frame_number):
plt.figure(figure_anim.number)
atom_dict_concs = frame_list[frame_number]
plt.title('Concentrations at frame {frame}'.format(frame=frame_number))
if average_filter:
title_str = 'Filtered concentrations at frame {frame}'.format(frame=frame_number)
else:
title_str = 'Concentrations at frame {frame}'.format(frame=frame_number)
plt.title(title_str)
for symbol, line in lines:
data = atom_dict_concs[symbol]
if average_filter:
......@@ -414,7 +425,7 @@ if __name__ == '__main__':
if multi_enable:
print("Drawing combined plot...", end="")
for i_frame, frame in enumerate(frame_list):
for i_frame, frame in enumerate(multi_combined_frame_list):
for symbol, conc_per_z in frame.items():
for i_z_pos, conc in enumerate(conc_per_z):
multi_combined_frame_list[i_frame][symbol][i_z_pos] = np.mean(conc)
......@@ -433,5 +444,6 @@ if __name__ == '__main__':
arguments.average_filter,
multi_path)
# TODO: write average lattice creation, simulation time
multi_report_file.close()
print("OK")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment