guan-0.0.108 guan.plot_two_array
This commit is contained in:
		@@ -262,6 +262,8 @@ guan.print_array(array, show_index=0, index_type=0)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
guan.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)
 | 
					guan.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)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					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_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.107
 | 
					version = 0.0.108
 | 
				
			||||||
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.107, updated on July 13, 2022.
 | 
					# The current version is guan-0.0.108, updated on July 13, 2022.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Installation: pip install --upgrade guan
 | 
					# Installation: pip install --upgrade guan
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1718,6 +1718,35 @@ def plot(x_array, y_array, xlabel='x', ylabel='y', title='', fontsize=20, labels
 | 
				
			|||||||
        plt.show()
 | 
					        plt.show()
 | 
				
			||||||
    plt.close('all')
 | 
					    plt.close('all')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					def 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): 
 | 
				
			||||||
 | 
					    import matplotlib.pyplot as plt
 | 
				
			||||||
 | 
					    fig, ax = plt.subplots()
 | 
				
			||||||
 | 
					    plt.subplots_adjust(bottom=adjust_bottom, left=adjust_left) 
 | 
				
			||||||
 | 
					    ax.plot(x_array, y1_array, style_1, linewidth=linewidth_1, markersize=markersize_1)
 | 
				
			||||||
 | 
					    ax.plot(x_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(y1_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_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