def test_plot_scatter(): # Set the random seed for consistency np.random.seed(12) fig, ax = plt.subplots(1) # The default line style is iterating over color, line, and marker with # hollow types. linestyle = mpltex.linestyle_generator(colors=[], lines=['-',':'], markers=['o','s'], hollow_styles=[False, False, True, True], ) for i in range(8): y = np.random.normal(size=10).cumsum() x = np.arange(10) ax.plot(x, y, label=str(i), **linestyle.next()) ax.locator_params(nbins=5) ax.set_xlabel('Number of steps') ax.set_ylabel('Distance') ax.legend(loc='best', ncol=4) fig.tight_layout(pad=0.1) fig.savefig('test_special_custom_linestyle_generator')
def test_plot_scatter(): # Set the random seed for consistency np.random.seed(12) fig, ax = plt.subplots(1) # The default line style is iterating over color, line, and marker with # hollow types. linestyle = mpltex.linestyle_generator( colors=[], lines=['-', ':'], markers=['o', 's'], hollow_styles=[False, False, True, True], ) for i in range(8): y = np.random.normal(size=10).cumsum() x = np.arange(10) ax.plot(x, y, label=str(i), **next(linestyle)) ax.locator_params(nbins=5) ax.set_xlabel('Number of steps') ax.set_ylabel('Distance') ax.legend(loc='best', ncol=4) fig.tight_layout(pad=0.35) fig.savefig('test_special_custom_linestyle_generator')
def plot_fig(): data = np.loadtxt("all.dat", dtype={'names': ('folder', 'x', 'dA/dx', 'err', 'A'), 'formats': ('S20', 'f4', 'f4', 'f4', 'f4')}) xcut = 27.5 # free energy beyong 27.5 is too large x0 = 28.36 # the top layer of Cu x, y = [], [] for i in range(len(data)): tx = data[i][1] ty = data[i][4] if tx < xcut: x.append(x0-tx) y.append(data[i][4]) fig, ax = plt.subplots(1) linestyle = mpltex.linestyle_generator( colors=["black", "green", "red"], lines=['-',':'], markers=['o','s'], hollow_styles=[False, False, True, True], ) ax.plot(x, y, label="", **linestyle.next()) ax.set_xlim([0, 9]) #ax.yaxis.set_ticks([0, 1, 2, 3, 4, 5, 6]) ax.set_xlabel("z$_I$ ($\AA$)") ax.set_ylabel("Free Energy (kcal/mol)") ax.legend(loc='best') fig.tight_layout(pad=0.1) fig.savefig("test.png", dpi=600)
def plot_fig(): data = np.loadtxt("dA.dat") data = data.transpose() x, y = data[0], data[1] y_int = integrate.cumtrapz(y, x, initial=0) linestyle = mpltex.linestyle_generator( colors=["black", "green", "red"], lines=['-',':'], markers=['o','s'], hollow_styles=[False, False, True, True], ) fig, ax = plt.subplots(1) ax.plot(x[::50], y_int[::50], label="FE", **linestyle.next()) ax.set_xlabel("r$_{C-O}$ ($\AA$)") ax.set_ylabel("FE (eV)") ax.legend(loc='best') ax2 = ax.twinx() ax2.plot(x[::50], y[::50], label="PMF", **linestyle.next()) ax2.set_ylabel("PMF (eV/$\AA$)", color="green") ax2.legend(loc='lower left') fig.tight_layout(pad=0.1) fig.savefig("test.png", dpi=600) o = open("all.dat", "w") for i in range(len(x)): o.write("%12.4f%12.4f%12.4f\n"% (x[i], y[i], y_int[i])) o.close()
def plot_fig_fe_pmf(): data = get_fe() x, y, yerr = data[0], data[1], data[2] y_int = integrate.cumtrapz(y, x, initial=0) linestyle = mpltex.linestyle_generator( colors=["black", "green", "red"], lines=['-', ':'], markers=['o', 's'], hollow_styles=[False, False, True, True], ) fig, ax = plt.subplots(1) ax.plot(x, y_int, label="FE", **linestyle.next()) ax.set_xlabel("r$_{C-O}$ ($\AA$)") ax.set_ylabel("FE (eV)") ax.legend(loc='best') ax2 = ax.twinx() ax2.errorbar(x, y, yerr=yerr, label="PMF", **linestyle.next()) ax2.set_ylabel("PMF (eV/$\AA$)", color="green") ax2.legend(loc='lower left') fig.tight_layout(pad=0.1) fig.savefig("01-fe-pmf.png", dpi=600) o = open("all.dat", "w") o.write('# CV PMF PMF(Error) Int\n') for i in range(len(x)): o.write("%12.4f%12.4f%12.4f%12.4f\n" % (x[i], y[i], yerr[i], y_int[i])) o.close()
def plot_fig(): data = np.loadtxt("all.dat", dtype={ 'names': ('folder', 'x', 'dA/dx', 'err', 'A'), 'formats': ('S20', 'f4', 'f4', 'f4', 'f4') }) xcut = 27.5 # free energy beyong 27.5 is too large x0 = 28.36 # the top layer of Cu x, y = [], [] for i in range(len(data)): tx = data[i][1] ty = data[i][4] if tx < xcut: x.append(x0 - tx) y.append(data[i][4]) fig, ax = plt.subplots(1) linestyle = mpltex.linestyle_generator( colors=["black", "green", "red"], lines=['-', ':'], markers=['o', 's'], hollow_styles=[False, False, True, True], ) ax.plot(x, y, label="", **linestyle.next()) ax.set_xlim([0, 9]) #ax.yaxis.set_ticks([0, 1, 2, 3, 4, 5, 6]) ax.set_xlabel("z$_I$ ($\AA$)") ax.set_ylabel("Free Energy (kcal/mol)") ax.legend(loc='best') fig.tight_layout(pad=0.1) fig.savefig("test.png", dpi=600)
def plot_fig(): data = np.loadtxt("fe.dat") data = data.transpose() x, y, yerr = data[0], data[1], data[2] y_int = integrate.cumtrapz(y, x, initial=0) linestyle = mpltex.linestyle_generator( colors=["black", "green", "red"], lines=['-',':'], markers=['o','s'], hollow_styles=[False, False, True, True], ) fig, ax = plt.subplots(1) ax.plot(x, y_int, label="FE", **linestyle.next()) ax.set_xlabel("r$_{C-O}$ ($\AA$)") ax.set_ylabel("FE (eV)") ax.legend(loc='best') ax2 = ax.twinx() ax2.errorbar(x, y, yerr=yerr, label="PMF", **linestyle.next()) ax2.set_ylabel("PMF (eV/$\AA$)", color="green") ax2.legend(loc='lower left') fig.tight_layout(pad=0.1) fig.savefig("test.png", dpi=600) o = open("all.dat", "w") for i in range(len(x)): o.write("%12.4f%12.4f%12.4f%12.4f\n"% (x[i], y[i], yerr[i], y_int[i])) o.close()
def plot_density(): #base_dir = 'benchmark/BCC' data_dir = ['B0.5_C25_scft/scft_out_943.mat', 'B0.5_C25_fts/fts_out_50000.mat', 'B25_C0.5_scft/scft_out_788.mat', 'B25_C0.5_fts/fts_out_50000.mat', ] is_cl = [False, True, False, True] labels = ['SCFT, $B=0.5, C=25$', 'CL, $B=0.5, C=25$', 'SCFT, $B=25, C=0.5$', 'CL, $B=25, C=0.5$', ] fig, ax = plt.subplots(1) linestyle = mpltex.linestyle_generator(lines=['-'], markers=[]) i = 0 for f in data_dir: print 'Processing ', f try: mat = loadmat(f) except: print 'Missing datafile', f continue x = mat['x'] x = x.reshape(x.size) if is_cl[i]: phi = mat['phi_avg'].real phi = phi.reshape(phi.size) else: phi = mat['phi'] phi = phi.reshape(phi.size) y = np.arange(-1, 1, 0.01) phi = cheb_interpolation_1d(y, phi) yp = 0.5 * (y + 1) * (x.max() - x.min()) ax.plot(yp, phi, label=labels[i], **linestyle.next()) i += 1 #ax.set_yscale('log') ax.locator_params(nbins=5) ax.set_xlabel('$x$') ax.set_ylabel('$\phi$') #ax.set_xlim([0.4, 0.6]) #ax.set_ylim([1.71, 1.76]) ax.legend(loc='best') fig.tight_layout(pad=0.1) fig.savefig('density_profile')
def my_plot(name): fig, ax = plt.subplots(1) linestyles = mpltex.linestyle_generator(markers=[]) #ax.plot(t, t, label='$t$', **next(linestyles)) ax.xaxis.set_major_locator(matplotlib.ticker.MultipleLocator(0.05)) ax.plot(strain, pz,linewidth=1, **next(linestyles),label="Pz") ax.plot(strain, py,linewidth=1, **next(linestyles),label="Py") ax.plot(strain, px,linewidth=1, **next(linestyles),label="Px") ax.set_xlabel('Strain') ax.set_ylabel('Stress') ax.legend(loc='best', ncol=2) plt.grid() fig.tight_layout(pad=0.1) fig.savefig("plot"+name[:-4])
def plot_fig(): data = np.loadtxt("all_wf.dat", dtype={ 'names': ('folder', 'x', 'dA/dx', 'err', 'A', 'wf'), 'formats': ('S20', 'f4', 'f4', 'f4', 'f4', 'f4') }) xcut = 27.5 # free energy beyong 27.5 is too large x0 = 28.36 # the top layer of Cu x, y, wf = [], [], [] for i in range(len(data)): tx = data[i][1] ty = data[i][4] twf = data[i][5] if tx < xcut: x.append(x0 - tx) y.append(ty) wf.append(-twf) fig, ax = plt.subplots(1) linestyle = mpltex.linestyle_generator( colors=["black", "green", "red"], lines=['-', ':'], markers=['o', 's'], hollow_styles=[False, False, True, True], ) ax.plot(x, y, label="Free Energy", **linestyle.next()) #ax.yaxis.set_ticks([0, 1, 2, 3, 4, 5, 6]) ax.set_xlabel("z$_I$ ($\AA$)") ax.set_ylabel("Free Energy (eV)") ax.legend(loc='upper right', bbox_to_anchor=(0.88, 0.97)) ax2 = ax.twinx() ax2.plot(x, wf, label="Work Function", **linestyle.next()) ax2.set_ylim([-5, -3]) ax2.set_ylabel("Work Function (eV)", color="green") ax2.tick_params(axis='y', colors='green') ax2.legend(loc='upper right', bbox_to_anchor=(0.93, 0.87)) ax.set_xlim([0, 9]) fig.tight_layout(pad=0.1) fig.savefig("test.png", dpi=600)
def plot_timeseries(t, data, ylabel, figname): fig, ax = plt.subplots(1) linestyle = mpltex.linestyle_generator(lines=['-'], markers=[], hollow_styles=[]) i = 0 for d in data: if t.size > 0: ax.plot(t, d, **linestyle.next()) else: ax.plot(d, **linestyle.next()) i += 1 ax.locator_params(nbins=5) ax.set_xlabel('$t$') ax.set_ylabel(ylabel) fig.tight_layout(pad=0.1) fig.savefig(figname) plt.close(fig)
def plot_spatial(x, data, ylabel, labels, figname): fig, ax = plt.subplots(1) linestyle = mpltex.linestyle_generator(lines=['-'], markers=['o'], hollow_styles=[]) i = 0 for d in data: if len(data) > 1: ax.plot(x, d, label=labels[i], **linestyle.next()) else: ax.plot(x, d, **linestyle.next()) i += 1 ax.locator_params(nbins=5) ax.set_xlabel('$z$') ax.set_ylabel(ylabel) if len(data) > 1: ax.legend(loc='best') fig.tight_layout(pad=0.1) fig.savefig(figname) plt.close(fig)
def plot_fig(): data = np.loadtxt( "all_wf.dat", dtype={"names": ("folder", "x", "dA/dx", "err", "A", "wf"), "formats": ("S20", "f4", "f4", "f4", "f4", "f4")}, ) xcut = 27.5 # free energy beyong 27.5 is too large x0 = 28.36 # the top layer of Cu x, y, wf = [], [], [] for i in range(len(data)): tx = data[i][1] ty = data[i][4] twf = data[i][5] if tx < xcut: x.append(x0 - tx) y.append(ty) wf.append(-twf) fig, ax = plt.subplots(1) linestyle = mpltex.linestyle_generator( colors=["black", "green", "red"], lines=["-", ":"], markers=["o", "s"], hollow_styles=[False, False, True, True] ) ax.plot(x, y, label="Free Energy", **linestyle.next()) # ax.yaxis.set_ticks([0, 1, 2, 3, 4, 5, 6]) ax.set_xlabel("z$_I$ ($\AA$)") ax.set_ylabel("Free Energy (eV)") ax.legend(loc="upper right", bbox_to_anchor=(0.88, 0.97)) ax2 = ax.twinx() ax2.plot(x, wf, label="Work Function", **linestyle.next()) ax2.set_ylim([-5, -3]) ax2.set_ylabel("Work Function (eV)", color="green") ax2.tick_params(axis="y", colors="green") ax2.legend(loc="upper right", bbox_to_anchor=(0.93, 0.87)) ax.set_xlim([0, 9]) fig.tight_layout(pad=0.1) fig.savefig("test.png", dpi=600)
def plot_fig_fe(): data = get_fe() x, y, yerr = data[0], data[1], data[2] y_int = integrate.cumtrapz(y, x, initial=0) linestyle = mpltex.linestyle_generator( colors=["black", "green", "red"], lines=['-', ':'], markers=['o', 's'], hollow_styles=[False, False, True, True], ) fig, ax = plt.subplots(1) ax.plot(x, y_int, label="FE", **linestyle.next()) ax.set_xlabel("r$_{C-O}$ ($\AA$)") ax.set_ylabel("FE (eV)") ax.legend(loc='best') fig.tight_layout(pad=0.1) fig.savefig("02-fe.png", dpi=600)
def plot_iw(): #base_dir = 'benchmark/BCC' data_dir = [#'B0.5_C25_fts_fixphi_run1/fts_out_50000.mat', 'B0.5_C25_fts_fixscftphi/fts_out_100000.mat', #'B0.5_C25_fts_fixscftphi_run1/fts_out_50000.mat', #'B0.5_C25_fts_fixscftphi_run2/fts_out_50000.mat', #'B0.5_C25_fts_fixscftphi_run3/fts_out_100000.mat', 'B0.5_C25_fts_fixscftphi_run4/fts_out_100000.mat', 'B0.5_C25_fts_fixscftphi_run5/fts_out_100000.mat', #'B0.5_C25_fts_fixscftphi_run6/fts_out_100000.mat', #'B0.5_C25_fts_fixotherphi/fts_out_50000.mat', #'B0.5_C25_fts_fixphi_Lx128/fts_out_50000.mat', ] is_cl = [True, True, True, True, True] labels = [#'$\phi_{CL}, L_x=64$', '$\phi_{SCFT}, \lambda\Delta t=10^{-6}, t=8 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-3}, t=3 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-4}, t=3 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-4}, t=8 \\times 10^4$', '$\phi_{SCFT}, \lambda\Delta t=10^{-5}, t=8 \\times 10^4$', '$\phi_{SCFT}, \lambda\Delta t=10^{-5}, t=8 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-2}, t=8 \\times 10^4$', #'$\phi_{other}, L_x=64$', #'$\phi_{CL}, L_x=128$' ] B = [0.5, 0.5, 0.5, 0.5, 0.5] C = [25, 25, 25, 25, 25] fig, ax = plt.subplots(1) linestyle = mpltex.linestyle_generator(lines=['-'], markers=['-o'], hollow_styles=[]) i = 0 for f in data_dir: print 'Processing ', f try: mat = loadmat(f) except: print 'Missing datafile', f continue x = mat['x'] x = x.reshape(x.size) if is_cl[i]: iw_avg = mat['iw_avg'].real iw_avg = iw_avg.reshape(iw_avg.size) phi_avg = mat['phi_avg'].real phi_avg = phi_avg.reshape(phi_avg.size) y = np.arange(-1, 1, 0.01) #iw_avg = cheb_interpolation_1d(y, iw_avg) phi_avg = cheb_interpolation_1d(y, phi_avg) yp = 0.5 * (y + 1) * (x.max() - x.min()) ax.plot(x, iw_avg, label=labels[i], **linestyle.next()) i += 1 #ax.set_yscale('log') ax.locator_params(nbins=5) ax.set_xlabel('$x$') ax.set_ylabel('$<iw>$') #ax.set_xlim([0.4, 0.6]) #ax.set_ylim([1.71, 1.76]) ax.legend(loc='best') fig.tight_layout(pad=0.1) fig.savefig('iw_profile')
mpl.use('Agg') import matplotlib.pyplot as plt import mpltex @mpltex.acs_decorator def plot_fig(): <<<<<<< HEAD data = np.loadtxt("all.xvg") ======= data = np.loadtxt("gofr.dat") >>>>>>> 2fa3d11b619e5b1e1192c57a96f67798715b647c data = data.transpose() fig, ax = plt.subplots(1) linestyle = mpltex.linestyle_generator( colors=["black", "green", "red"], lines=['-',':'], markers=['o','s'], hollow_styles=[False, False, True, True], ) <<<<<<< HEAD ax.plot(data[0][::10]*10, data[1][::10], label="k = 500", **linestyle.next()) ax.plot(data[2][::10]*10, data[3][::10] + 1.2, label="k = 1000", **linestyle.next()) ax.plot(data[4][::10]*10, data[5][::10] + 3.3, label="k = 1500", **linestyle.next()) ax.set_xlim([1.8, 6.7]) ax.set_xlabel("r$_{Li-N}$ ($\AA$)") ax.set_ylabel("Free Energy (kcal/mol)") ax.legend(loc='best') =======
def plot_force(): #base_dir = 'benchmark/BCC' data_dir = [#'B0.5_C25_fts_fixphi_run1/fts_out_50000.mat', #'B0.5_C25_fts_fixscftphi/fts_out_100000.mat', #'B0.5_C25_fts_fixscftphi_run1/fts_out_50000.mat', #'B0.5_C25_fts_fixscftphi_run2/fts_out_50000.mat', #'B0.5_C25_fts_fixscftphi_run3/fts_out_100000.mat', #'B0.5_C25_fts_fixscftphi_run4/fts_out_100000.mat', #'B0.5_C25_fts_fixscftphi_run5/fts_out_100000.mat', #'B0.5_C25_fts_fixscftphi_run6/fts_out_100000.mat', #'B0.5_C25_fts_fixscftphi_run7/fts_out_100000.mat', 'B25_C0.5_fts_fixclphi_update_phi_imag/fts_out_100000.mat', #'B25_C0.5_fts_fixphi/fts_out_50000.mat', #'B25_C0.5_fts_fixphi_run1/fts_out_50000.mat', #'B25_C0.5_fts_fixscftphi/fts_out_100000.mat', #'B25_C0.5_fts_fixscftphi_update_phi_imag/fts_out_150000.mat', #'B25_C0.5_fts_fixscftphi_update_phi_imag_run1/fts_out_100000.mat', #'B25_C0.5_fts_fixscftphi_update_phi_imag_run2/fts_out_100000.mat', #'B0.5_C25_fts_fixscftphi_update_phi_imag_run1/fts_out_100000.mat', #'B0.5_C25_fts_fixscftphi_update_phi_imag_run2/fts_out_100000.mat', #'B0.5_C25_fts_fixscftphi_update_phi_imag_run3/fts_out_200000.mat', #'B0.5_C25_fts_fixotherphi/fts_out_50000.mat', #'B0.5_C25_fts_fixphi_Lx128/fts_out_50000.mat', ] is_cl = [True, True, True, True, True] labels = [#'$\phi_{CL}, L_x=64$', '$\phi_{CL}, \lambda\Delta t=10^{-3}, t=8 \\times 10^4$', #'$\phi_{CL}, \lambda\Delta t=10^{-3}, t=3 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-3}, t=8 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-3}, t=1 \\times 10^5$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-3}, t=8 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-3}, t=6 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-4}, t=5 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-3}, t=8 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-3}, t=1.8 \\times 10^5$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-3}, t=3 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-4}, t=3 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-4}, t=8 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-5}, t=8 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-5}, t=8 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-2}, t=8 \\times 10^4$', #'$\phi_{SCFT}, \lambda\Delta t=10^{-6}, t=8 \\times 10^4$', #'$\phi_{other}, L_x=64$', #'$\phi_{CL}, L_x=128$' ] B = [0.5, 0.5, 0.5, 0.5, 0.5] C = [25, 25, 25, 25, 25] fig, ax = plt.subplots(1) linestyle = mpltex.linestyle_generator(lines=['-'], markers=['o'], hollow_styles=[]) i = 0 for f in data_dir: print 'Processing ', f try: mat = loadmat(f) except: print 'Missing datafile', f continue x = mat['x'] x = x.reshape(x.size) if is_cl[i]: iw_avg = mat['iw_avg'].real iw_avg = iw_avg.reshape(iw_avg.size) phi = mat['phi'].real phi = phi.reshape(phi.size) y = np.arange(-1, 1, 0.01) force = C[i] * phi - iw_avg / B[i] print "\tmean force: ", 0.5 * cheb_quadrature_clencurt(force) #force = cheb_interpolation_1d(y, force) #yp = 0.5 * (y + 1) * (x.max() - x.min()) ax.plot(x, force, label=labels[i], **linestyle.next()) i += 1 #ax.set_yscale('log') ax.locator_params(nbins=5) ax.set_xlabel('$x$') ax.set_ylabel('$<\\frac{\delta H}{\delta \phi}>_{\phi}$') #ax.set_xlim([0.4, 0.6]) #ax.set_ylim([1.71, 1.76]) ax.legend(loc='best') fig.tight_layout(pad=0.1) fig.savefig('force_profile')
def plot_fig(): fig, ax = plt.subplots(1) linestyle = mpltex.linestyle_generator( colors=["black", "black", "red", "red"], lines=['-', ':'], markers=['o', 'o', '^', '^'], hollow_styles=[False, False, True, True], ) # plot data 1 data = np.loadtxt("gofr_1.dat") data = data.transpose() x, y = [], [] for i in range(len(data[0])): if i <= 50: x.append(data[0][i]) y.append(data[1][i]) else: if i % 10 == 0: x.append(data[0][i]) y.append(data[1][i]) ax.plot(x, y, label="I$^-$(bulk)-H", **linestyle.next()) ax2 = ax.twinx() ax2.plot(data[0][::10], data[2][::10], **linestyle.next()) # plot data 2 data = np.loadtxt("gofr_2.dat") data = data.transpose() x, y = [], [] for i in range(len(data[0])): if i <= 50: x.append(data[0][i]) y.append(data[1][i]) else: if i % 10 == 0: x.append(data[0][i]) y.append(data[1][i]) ax.plot(x, y, label="I*(interface)-H", **linestyle.next()) # add annodate ax2.plot(data[0][::5], data[2][::5], **linestyle.next()) ax2.plot([3.0, 8.0], [5.0, 5.0], ls="dotted", lw=0.5, color="black") ax2.text(7.0, 5.2, "N = 5") # set up axis ax.set_xlabel("r$_{I-H}$ ($\AA$)") ax.yaxis.set_ticks([0, 1, 2, 3, 4, 5, 6]) ax.set_ylabel("g(r)") ax.legend(loc='upper right', bbox_to_anchor=(0.85, 0.95)) ax2.set_ylim([0.0, 8.0]) ax2.set_xlim([1.0, 8.0]) ax2.set_ylabel("$\int$g(r) (N)") # output fig.tight_layout(pad=0.1) fig.savefig("test.png", dpi=600)
bbox_inches=bbox) if __name__ == "__main__": gns_display = [ 'email-Enron', 'email-Eu', 'contact-primary-school', 'contact-high-school', 'NDC-classes', 'NDC-substances', 'DAWN', 'congress-bills', 'tags-ask-ubuntu', 'tags-math-sx', 'threads-ask-ubuntu', 'threads-math-sx', 'coauth-MAG-History', 'coauth-MAG-Geology', 'coauth-DBLP' ] linestyle_map = defaultdict(str) dotstyle_map = defaultdict(str) linestyles = mpltex.linestyle_generator() dotstyles = mpltex.linestyle_generator(lines=[]) for gn in gns_display: if gn == "DAWN": # I don't like pink next(linestyles) next(dotstyles) linestyle_map[gn] = next(linestyles) dotstyle_map[gn] = next(dotstyles) """ Legnd """ save_legend(n_cols=3) """ Dot plot """ for neg in ["hub", "clique"]: for imb in [10]: plot_dots(neg_type=neg, imb=imb, seed=0) """ MI Correlation plot """ for imb in [10, 5, 2, 1]: