0.0.115
This commit is contained in:
		| @@ -274,8 +274,12 @@ guan.plot(x_array, y_array, xlabel='x', ylabel='y', title='', fontsize=20, label | |||||||
|  |  | ||||||
| guan.plot_two_array(x_array, y1_array, y2_array, xlabel='x', ylabel='y', title='', fontsize=20, labelsize=20, show=1, save=0, filename='a', format='jpg', dpi=300, style_1='', style_2='', y_min=None, y_max=None, linewidth_1=None, linewidth_2=None, markersize_1=None, markersize_2=None, adjust_bottom=0.2, adjust_left=0.2) | guan.plot_two_array(x_array, y1_array, y2_array, xlabel='x', ylabel='y', title='', fontsize=20, labelsize=20, show=1, save=0, filename='a', format='jpg', dpi=300, style_1='', style_2='', y_min=None, y_max=None, linewidth_1=None, linewidth_2=None, markersize_1=None, markersize_2=None, adjust_bottom=0.2, adjust_left=0.2) | ||||||
|  |  | ||||||
|  | guan.plot_two_array_with_two_horizontal_array(x1_array, x2_array, y1_array, y2_array, xlabel='x', ylabel='y', title='', fontsize=20, labelsize=20, show=1, save=0, filename='a', format='jpg', dpi=300, style_1='', style_2='', y_min=None, y_max=None, linewidth_1=None, linewidth_2=None, markersize_1=None, markersize_2=None, adjust_bottom=0.2, adjust_left=0.2) | ||||||
|  |  | ||||||
| guan.plot_three_array(x_array, y1_array, y2_array, y3_array, xlabel='x', ylabel='y', title='', fontsize=20, labelsize=20, show=1, save=0, filename='a', format='jpg', dpi=300, style_1='', style_2='', style_3='', y_min=None, y_max=None, linewidth_1=None, linewidth_2=None, linewidth_3=None,markersize_1=None, markersize_2=None, markersize_3=None, adjust_bottom=0.2, adjust_left=0.2) | guan.plot_three_array(x_array, y1_array, y2_array, y3_array, xlabel='x', ylabel='y', title='', fontsize=20, labelsize=20, show=1, save=0, filename='a', format='jpg', dpi=300, style_1='', style_2='', style_3='', y_min=None, y_max=None, linewidth_1=None, linewidth_2=None, linewidth_3=None,markersize_1=None, markersize_2=None, markersize_3=None, adjust_bottom=0.2, adjust_left=0.2) | ||||||
|  |  | ||||||
|  | guan.plot_three_array_with_three_horizontal_array(x1_array, x2_array, x3_array, y1_array, y2_array, y3_array, xlabel='x', ylabel='y', title='', fontsize=20, labelsize=20, show=1, save=0, filename='a', format='jpg', dpi=300, style_1='', style_2='', style_3='', y_min=None, y_max=None, linewidth_1=None, linewidth_2=None, linewidth_3=None,markersize_1=None, markersize_2=None, markersize_3=None, adjust_bottom=0.2, adjust_left=0.2) | ||||||
|  |  | ||||||
| guan.plot_3d_surface(x_array, y_array, matrix, xlabel='x', ylabel='y', zlabel='z', title='', fontsize=20, labelsize=15, show=1, save=0, filename='a', format='jpg', dpi=300, z_min=None, z_max=None, rcount=100, ccount=100) | guan.plot_3d_surface(x_array, y_array, matrix, xlabel='x', ylabel='y', zlabel='z', title='', fontsize=20, labelsize=15, show=1, save=0, filename='a', format='jpg', dpi=300, z_min=None, z_max=None, rcount=100, ccount=100) | ||||||
|  |  | ||||||
| guan.plot_contour(x_array, y_array, matrix, xlabel='x', ylabel='y', title='', fontsize=20, labelsize=15, show=1, save=0, filename='a', format='jpg', dpi=300) | guan.plot_contour(x_array, y_array, matrix, xlabel='x', ylabel='y', title='', fontsize=20, labelsize=15, show=1, save=0, filename='a', format='jpg', dpi=300) | ||||||
|   | |||||||
| @@ -1,7 +1,7 @@ | |||||||
| [metadata] | [metadata] | ||||||
| # replace with your username: | # replace with your username: | ||||||
| name = guan | name = guan | ||||||
| version = 0.0.114 | version = 0.0.115 | ||||||
| author = guanjihuan | author = guanjihuan | ||||||
| author_email = guanjihuan@163.com | author_email = guanjihuan@163.com | ||||||
| description = An open source python package | description = An open source python package | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
|  |  | ||||||
| # With this package, you can calculate band structures, density of states, quantum transport and topological invariant of tight-binding models by invoking the functions you need. Other frequently used functions are also integrated in this package, such as file reading/writing, figure plotting, data processing. | # With this package, you can calculate band structures, density of states, quantum transport and topological invariant of tight-binding models by invoking the functions you need. Other frequently used functions are also integrated in this package, such as file reading/writing, figure plotting, data processing. | ||||||
|  |  | ||||||
| # The current version is guan-0.0.114, updated on July 20, 2022. | # The current version is guan-0.0.115, updated on July 20, 2022. | ||||||
|  |  | ||||||
| # Installation: pip install --upgrade guan | # Installation: pip install --upgrade guan | ||||||
|  |  | ||||||
| @@ -1821,6 +1821,35 @@ def plot_two_array(x_array, y1_array, y2_array, xlabel='x', ylabel='y', title='' | |||||||
|         plt.show() |         plt.show() | ||||||
|     plt.close('all') |     plt.close('all') | ||||||
|  |  | ||||||
|  | def plot_two_array_with_two_horizontal_array(x1_array, x2_array, y1_array, y2_array, xlabel='x', ylabel='y', title='', fontsize=20, labelsize=20, show=1, save=0, filename='a', format='jpg', dpi=300, style_1='', style_2='', y_min=None, y_max=None, linewidth_1=None, linewidth_2=None, markersize_1=None, markersize_2=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)  | ||||||
|  |     ax.plot(x1_array, y1_array, style_1, linewidth=linewidth_1, markersize=markersize_1) | ||||||
|  |     ax.plot(x2_array, y2_array, style_2, linewidth=linewidth_2, markersize=markersize_2) | ||||||
|  |     ax.grid() | ||||||
|  |     ax.set_title(title, fontsize=fontsize, fontfamily='Times New Roman') | ||||||
|  |     ax.set_xlabel(xlabel, fontsize=fontsize, fontfamily='Times New Roman')  | ||||||
|  |     ax.set_ylabel(ylabel, fontsize=fontsize, fontfamily='Times New Roman')  | ||||||
|  |     if y_min!=None or y_max!=None: | ||||||
|  |         if y_min==None: | ||||||
|  |             y1_min=min(y1_array) | ||||||
|  |             y2_min=min(y2_array) | ||||||
|  |             y_min=min([y1_min, y2_min]) | ||||||
|  |         if y_max==None: | ||||||
|  |             y1_max=max(y1_array) | ||||||
|  |             y2_max=max(y2_array) | ||||||
|  |             y_max=max([y1_max, y2_max]) | ||||||
|  |         ax.set_ylim(y_min, y_max) | ||||||
|  |     ax.tick_params(labelsize=labelsize)  | ||||||
|  |     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)  | ||||||
|  |     if show == 1: | ||||||
|  |         plt.show() | ||||||
|  |     plt.close('all') | ||||||
|  |  | ||||||
| def plot_three_array(x_array, y1_array, y2_array, y3_array, xlabel='x', ylabel='y', title='', fontsize=20, labelsize=20, show=1, save=0, filename='a', format='jpg', dpi=300, style_1='', style_2='', style_3='', y_min=None, y_max=None, linewidth_1=None, linewidth_2=None, linewidth_3=None,markersize_1=None, markersize_2=None, markersize_3=None, adjust_bottom=0.2, adjust_left=0.2):  | def plot_three_array(x_array, y1_array, y2_array, y3_array, xlabel='x', ylabel='y', title='', fontsize=20, labelsize=20, show=1, save=0, filename='a', format='jpg', dpi=300, style_1='', style_2='', style_3='', y_min=None, y_max=None, linewidth_1=None, linewidth_2=None, linewidth_3=None,markersize_1=None, markersize_2=None, markersize_3=None, adjust_bottom=0.2, adjust_left=0.2):  | ||||||
|     import matplotlib.pyplot as plt |     import matplotlib.pyplot as plt | ||||||
|     fig, ax = plt.subplots() |     fig, ax = plt.subplots() | ||||||
| @@ -1853,6 +1882,38 @@ def plot_three_array(x_array, y1_array, y2_array, y3_array, xlabel='x', ylabel=' | |||||||
|         plt.show() |         plt.show() | ||||||
|     plt.close('all') |     plt.close('all') | ||||||
|  |  | ||||||
|  | def plot_three_array_with_three_horizontal_array(x1_array, x2_array, x3_array, y1_array, y2_array, y3_array, xlabel='x', ylabel='y', title='', fontsize=20, labelsize=20, show=1, save=0, filename='a', format='jpg', dpi=300, style_1='', style_2='', style_3='', y_min=None, y_max=None, linewidth_1=None, linewidth_2=None, linewidth_3=None,markersize_1=None, markersize_2=None, markersize_3=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)  | ||||||
|  |     ax.plot(x1_array, y1_array, style_1, linewidth=linewidth_1, markersize=markersize_1) | ||||||
|  |     ax.plot(x2_array, y2_array, style_2, linewidth=linewidth_2, markersize=markersize_2) | ||||||
|  |     ax.plot(x3_array, y3_array, style_3, linewidth=linewidth_3, markersize=markersize_3) | ||||||
|  |     ax.grid() | ||||||
|  |     ax.set_title(title, fontsize=fontsize, fontfamily='Times New Roman') | ||||||
|  |     ax.set_xlabel(xlabel, fontsize=fontsize, fontfamily='Times New Roman')  | ||||||
|  |     ax.set_ylabel(ylabel, fontsize=fontsize, fontfamily='Times New Roman')  | ||||||
|  |     if y_min!=None or y_max!=None: | ||||||
|  |         if y_min==None: | ||||||
|  |             y1_min=min(y1_array) | ||||||
|  |             y2_min=min(y2_array) | ||||||
|  |             y3_min=min(y3_array) | ||||||
|  |             y_min=min([y1_min, y2_min, y3_min]) | ||||||
|  |         if y_max==None: | ||||||
|  |             y1_max=max(y1_array) | ||||||
|  |             y2_max=max(y2_array) | ||||||
|  |             y3_max=max(y3_array) | ||||||
|  |             y_max=max([y1_max, y2_max, y3_max]) | ||||||
|  |         ax.set_ylim(y_min, y_max) | ||||||
|  |     ax.tick_params(labelsize=labelsize)  | ||||||
|  |     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)  | ||||||
|  |     if show == 1: | ||||||
|  |         plt.show() | ||||||
|  |     plt.close('all') | ||||||
|  |  | ||||||
| def plot_3d_surface(x_array, y_array, matrix, xlabel='x', ylabel='y', zlabel='z', title='', fontsize=20, labelsize=15, show=1, save=0, filename='a', format='jpg', dpi=300, z_min=None, z_max=None, rcount=100, ccount=100):  | def plot_3d_surface(x_array, y_array, matrix, xlabel='x', ylabel='y', zlabel='z', title='', fontsize=20, labelsize=15, show=1, save=0, filename='a', format='jpg', dpi=300, z_min=None, z_max=None, rcount=100, ccount=100):  | ||||||
|     import matplotlib.pyplot as plt |     import matplotlib.pyplot as plt | ||||||
|     from matplotlib import cm |     from matplotlib import cm | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user