file_format

This commit is contained in:
2022-09-12 04:53:36 +08:00
parent 4ef5ea4f73
commit 1d29ee5e29
12 changed files with 34 additions and 34 deletions

View File

@@ -71,7 +71,7 @@ def calculate_eigenvalue_with_one_parameter(x_array, hamiltonian_function, print
i0 += 1
return eigenvalue_array
def plot(x_array, y_array, xlabel='x', ylabel='y', title='', fontsize=20, labelsize=20, show=1, save=0, filename='a', format='jpg', dpi=300, style='', y_min=None, y_max=None, linewidth=None, markersize=None, adjust_bottom=0.2, adjust_left=0.2):
def plot(x_array, y_array, xlabel='x', ylabel='y', title='', fontsize=20, labelsize=20, show=1, save=0, filename='a', file_format='.jpg', dpi=300, style='', y_min=None, y_max=None, linewidth=None, markersize=None, adjust_bottom=0.2, adjust_left=0.2):
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
plt.subplots_adjust(bottom=adjust_bottom, left=adjust_left)
@@ -90,7 +90,7 @@ def plot(x_array, y_array, xlabel='x', ylabel='y', title='', fontsize=20, labels
labels = ax.get_xticklabels() + ax.get_yticklabels()
[label.set_fontname('Times New Roman') for label in labels]
if save == 1:
plt.savefig(filename+'.'+format, dpi=dpi)
plt.savefig(filename+file_format, dpi=dpi)
if show == 1:
plt.show()
plt.close('all')