diff --git a/API_reference.py b/API_reference.py index b3a840c..25fbe6a 100644 --- a/API_reference.py +++ b/API_reference.py @@ -107,9 +107,9 @@ guan.write_one_dimensional_data(x_array, y_array, filename='a') guan.write_two_dimensional_data(x_array, y_array, matrix, filename='a') # plot figures # Source code: https://py.guanjihuan.com/plot_figures -guan.plot(x_array, y_array, xlabel='x', ylabel='y', title='', filename='a', show=1, save=0, type='', y_min=None, y_max=None, linewidth=None, markersize=None) -guan.plot_3d_surface(x_array, y_array, matrix, xlabel='x', ylabel='y', zlabel='z', title='', filename='a', show=1, save=0, z_min=None, z_max=None) -guan.plot_contour(x_array, y_array, matrix, xlabel='x', ylabel='y', title='', filename='a', show=1, save=0) +guan.plot(x_array, y_array, xlabel='x', ylabel='y', title='', filename='a', show=1, save=0, format='jpg', dpi=300, type='', y_min=None, y_max=None, linewidth=None, markersize=None) +guan.plot_3d_surface(x_array, y_array, matrix, xlabel='x', ylabel='y', zlabel='z', title='', filename='a', show=1, save=0, format='jpg', dpi=300, z_min=None, z_max=None) +guan.plot_contour(x_array, y_array, matrix, xlabel='x', ylabel='y', title='', filename='a', show=1, save=0, format='jpg', dpi=300) # others # Source code: https://py.guanjihuan.com/source-code/others guan.download_with_scihub(address=None, num=1) diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index 8758803..8b36c33 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.0.31 +version = 0.0.32 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/PyPI/src/guan/plot_figures.py b/PyPI/src/guan/plot_figures.py index 89224b5..9aa66fe 100644 --- a/PyPI/src/guan/plot_figures.py +++ b/PyPI/src/guan/plot_figures.py @@ -4,7 +4,7 @@ import numpy as np -def plot(x_array, y_array, xlabel='x', ylabel='y', title='', filename='a', show=1, save=0, type='', y_min=None, y_max=None, linewidth=None, markersize=None): +def plot(x_array, y_array, xlabel='x', ylabel='y', title='', filename='a', show=1, save=0, format='jpg', dpi=300, type='', y_min=None, y_max=None, linewidth=None, markersize=None): import matplotlib.pyplot as plt fig, ax = plt.subplots() plt.subplots_adjust(bottom=0.20, left=0.18) @@ -23,12 +23,12 @@ def plot(x_array, y_array, xlabel='x', ylabel='y', title='', filename='a', show= labels = ax.get_xticklabels() + ax.get_yticklabels() [label.set_fontname('Times New Roman') for label in labels] if save == 1: - plt.savefig(filename+'.jpg', dpi=300) + plt.savefig(filename+format, dpi=dpi) if show == 1: plt.show() plt.close('all') -def plot_3d_surface(x_array, y_array, matrix, xlabel='x', ylabel='y', zlabel='z', title='', filename='a', show=1, save=0, z_min=None, z_max=None): +def plot_3d_surface(x_array, y_array, matrix, xlabel='x', ylabel='y', zlabel='z', title='', filename='a', show=1, save=0, format='jpg', dpi=300, z_min=None, z_max=None): import matplotlib.pyplot as plt from matplotlib import cm from matplotlib.ticker import LinearLocator @@ -62,12 +62,12 @@ def plot_3d_surface(x_array, y_array, matrix, xlabel='x', ylabel='y', zlabel='z' for l in cbar.ax.yaxis.get_ticklabels(): l.set_family('Times New Roman') if save == 1: - plt.savefig(filename+'.jpg', dpi=300) + plt.savefig(filename+format, dpi=dpi) if show == 1: plt.show() plt.close('all') -def plot_contour(x_array, y_array, matrix, xlabel='x', ylabel='y', title='', filename='a', show=1, save=0): +def plot_contour(x_array, y_array, matrix, xlabel='x', ylabel='y', title='', filename='a', show=1, save=0, format='jpg', dpi=300): import matplotlib.pyplot as plt fig, ax = plt.subplots() plt.subplots_adjust(bottom=0.2, right=0.75, left = 0.16) @@ -85,7 +85,7 @@ def plot_contour(x_array, y_array, matrix, xlabel='x', ylabel='y', title='', fil for l in cbar.ax.yaxis.get_ticklabels(): l.set_family('Times New Roman') if save == 1: - plt.savefig(filename+'.jpg', dpi=300) + plt.savefig(filename+format, dpi=dpi) if show == 1: plt.show() plt.close('all') \ No newline at end of file