示例#1
0
 def alphaPlot(self):
     numModels = len(self.models)
     ax = plt.subplot(111)
     beginXs = None
     beginInds = []
     offset = 0
     for model in self.models:
         yieldMap = model.yields[self.stock.name]
         xs = list(yieldMap.keys())
         inds = np.arange(len(yieldMap.keys()))
         if len(beginInds) == 0:
             beginInds = inds
             beginXs = xs
             ys = list(yieldMap.values())
             xs = [x + offset for x in xs]
             inds = [x + offset for x in inds]
             offset += .1
             ax.bar(inds,
                    ys,
                    width=.1,
                    align='center',
                    label=model.name + "-" + stock)
     plt.set(title=r"Percent Yield as $\alpha$ Changes",
             xlabel=r'$\alpha$',
             ylabel='Percent Yield')
     plt.legend()
     plt.savefig(
         'C:\\Users\\x92423\\Dropbox\\Research\\Math Thesis\\Results\\' +
         self.name + '-alphaplot.png')
     plt.show()
示例#2
0
文件: app.py 项目: yivash/mystic-bit
def run_mystic_bit():
    df = pd.read_csv('./static/HACKA_DS_WELL_SPATIAL.csv')
    plt = sns.relplot(x="X", y="Y", hue="hackname", size="hackname", 
    sizes=(150, 150), facet_kws=dict({'legend_out':True}),data=df)
    new_title = 'Wells'
    plt._legend.set_title(new_title)
    plt.set(xlim=(0, 30))
    plt.set(ylim=(0, 30))
    plt.savefig('static/map_plot.png')
    return render_template('my_template.html', name ='map', url='/static/map_plot.png')
示例#3
0
def overUnderScatter(
):  # this returns a scatter plot of an over/under simulation
    n = 500
    x = np.random.rand(n)
    y = winList
    colors = (0, 0, 0)
    plt.scatter(x, y, c=colors, alpha=0.5)
    plt.set(title="Over Under Sim Returns")
    plt.ylabel('Profit')
    plt.xaxis('U.S. Dollar (Thousands)')
    plt.show()
示例#4
0
def sampling_issue(I0_orig, SunEllipticFactor, zwvl, ssim_zfwhm, neon_wvl,
                   neon_fwhm, t_Ts, t_ts):
    '''
    Created by: Logan Wright
    Created On: December 20 2018

    Translated from original MATLAB Code

    DESCRIPTION:

    Inputs:

    Outputs:

    '''
    # Demonstrate Sampling Issue
    I0_ssim = SunEllipticFactor * super_resample(I0_orig[:, 1], I0_orig[:, 0],
                                                 zwvl, ssim_zfwhm)
    Ig_ssim = I0_ssim * super_resample(t_Ts + t_ts, wvl, zwvl, ssim_zfwhm)
    Ig_NIS = I0 * super_resample(t_Ts + t_ts, wvl, neon_wvl, neon_fwhm)
    Ig_ssim_resampled = super_resample(
        I0_ssim[17:end] *
        super_resample(t_Ts + t_ts, wvl, zwvl[17:end], ssim_zfwhm[17:end]),
        zwvl[17:end], neon_wvl, neon_fwhm)
    plt.figure()
    # plot(I0_orig(:,1),I0_orig(:,2),'k')
    plt.plot(neon_wvl, Ig_NIS, 'Color', [0, 0, 0])
    plt.plot(zwvl, Ig_ssim, 'Color', [33, 102, 172] / 255)
    plt.plot(neon_wvl, Ig_ssim_resampled, 'Color', [178, 24, 43] / 255)

    plt.legend('NIS Sampling', 'SSIM Sampling', 'SSIM Resampled to NIS')
    plt.ylabel('Spectral Irradiance [W m^{-2} nm^{-1}]')
    plt.xlabel('Wavelength [nm]')
    plt.title('Modelled Downwelling Irradiance')
    plt.set(gca, 'FontSize', 18)
    plt.axis([720, 800, 0.7, 1.3])
    plt.grid()
    plt.savefig('IrradianceDiffRespFunc_O2.svg', 'svg')
    plt.axis([350, 1025, 0, 1.8])
    plt.savefig('IrradianceDiffRespFunc_Full.svg', 'svg')

    plt.figure
    plt.plot(neon_wvl, Ig_NIS - Ig_ssim_resampled, 'k')
    plt.ylabel('Spectral Irradiance [W m^{-2} nm^{-1}]')
    plt.xlabel('Wavelength [nm]')
    plt.title('Difference Between NIS and SSIM Sampling')
    plt.axis([720, 800, -0.15, 0.1])
    plt.grid()
    plt.set(gca, 'FontSize', 18)
    plt.savefig('DiffRespFunc_O2.svg', 'svg')
def getDayOfWeekTrend(df,industries):
    ind_subset = getIndSubset(df,industries)
    dateDict = {0: 'Monday',1: 'Tuesday', 2: 'Wednesday',3: 'Thursday',4: 'Friday', 5: 'Saturday', 6: 'Sunday'}    
    ind_group_dict = {}
    for ind in industries:
        ind_dow = ind_subset.where(ind_subset.industry==ind)
        ind_dow.drop(columns='industry',inplace=True)
        ind_dow.dropna(axis = 0,inplace=True)
        ind_dow['Day_of_week'] = pd.to_datetime(ind_dow['date']).dt.dayofweek 
        j = ind_dow[['date','Day_of_week']].groupby('Day_of_week').count()
        j.index = j.index.map(dateDict.get)
        j.columns = ['Total_volume_by_day']
        plt = j.plot(kind='bar',title=ind+' Total Volume by Day',legend=False,rot=50)
        plt.set(ylabel='Total Volume')
        ind_group_dict[ind] = j
    return ind_group_dict
示例#6
0
def plotMedianGeneExpression(genes,
                             tissueIds,
                             kind="bar",
                             title='Median Gene Expression',
                             figsize=None,
                             rot=None,
                             xlabel='Gene',
                             ylabel='Median (TPM)'):
    """
    genes - a list of gene symbols, versioned gencode Ids, or unversioned gencode Ids.
    tissueIds - a list of tissueSiteDetailIds.
    kind - the kind of plot to produce (bar, barh, etc)
    title, figsize, rot, xlabel, ylabel - settings for matplotlib
    """
    mModel = _getMedianGeneExpressionModel(genes, tissueIds)
    index, data = mModel.getMedianExpression()
    df = pd.DataFrame(data=data, index=index)
    # df = df.transpose()

    # https://pandas.pydata.org/pandas-docs/stable/user_guide/visualization.html
    plt = df.plot(kind=kind, title=title, figsize=figsize, rot=rot)
    plt.set(xlabel=xlabel, ylabel=ylabel)
示例#7
0
def execute_job(jid):

    update_job_status(jid, 'in progress')

    animals = json.loads(rd.get('key'))
    outputType = animals['output_type']

    job_id = 'job.{}'.format(jid)

    euthanasia = 0
    returnedToOwner = 0
    adoption = 0
    transfer = 0

    for x in outputType:
        if x == 'Euthanasia':
            euthanasia = euthanasia + 1
        if x == 'Return to Owner':
            returnedToOwner = returnedToOwner + 1
        if x == 'Adoption':
            adoption = adoption + 1
        if x == 'Transfer':
            transfer = transfer + 1

    x = ['Euthanasia', 'Return to Owner', 'Adoption', 'Transfer']
    y = [euthanasia, returnedToOwner, adoption, transfer]

    plt.figure()

    plt.bar(y)
    plt.set(gca, 'XTickLabel', {'EU', 'RTO', 'ADP', 'TR'})

    plt.savefig('/outputtype.png')
    with open('/outputtype.png', 'rb') as f:
        img = f.read()

    rd_imgs.hset(jid, 'image', img)
    update_job_status(jid, 'complete')
示例#8
0
def barch(plt):
	years = [ "1996", "2001", "2007", "2012" ]
	krange = tuple(range(1,6+1))
	def ind(yr):
		return years.index (yr)

	hm = {}
	hm[1] = [0] * 2 + [1] * 3 + [2] * 6 + [3] * 13
	hm[2] = [0] * 2 + [1] * 4 + [2] * 2 + [3] * 6
	hm[3] = [0] * 6 + [1] * 10+ [2] * 11+ [3] * 14
	hm[4] = [0] * 19+ [1] * 27+ [2] * 18+ [3] * 32
	hm[5] = [0] * 36+ [1] * 27+ [2] * 11+ [3] * 12
	hm[6] = [0] * 0 + [1] * 0 + [2] * 0 + [3] * 0
	m = [hm[v] for v in krange]
	total = { 0 : 2+2+6+19+36+0, 1 : 3+4+10+27+27+0, 2 : 6+2+11+18+11+0, 3 : 13+6+14+32+12+0 }

	colors = ["#88ccee", "#44aa99", "#999933", "#DDCC77", "#CC6677", "#882255", "#AA4499" ]
	#colors = ["#222222", "#666666", "#aaaaaa", "#eeeeee", "#dddddd", "#882255", "#AA4499" ]
	colors = colors[0:len(krange)]


	plt.set(xlabel='Survey year')
	plt.set(ylabel ='MOI (across samples)')
	plt.set_xticks(range(4))
	plt.set_xticklabels (years)
	plt.set (xlim=[-0.5,3.5])
	plt.yaxis.set_major_formatter(mtick.PercentFormatter())
	plt.set (ylim = [0,100])

	weights = np.array ([[100.0 / float(total[int(y)]) for y in hm[v]] for v in krange])
	bins = np.arange (len(years)+1) - 0.5
	hatch='/'
	_, _, patches = plt.hist(m, bins=bins, histtype='bar', stacked=True, weights=weights, rwidth=0.5, color=colors, label=["%d%s strain%s" % (v, "" if v != krange[-1] else "+", "s" if v != krange[0] else "") for v in krange]) #, hatch=hatch)
	plt.legend (bbox_to_anchor=(1.04,0.5), loc="center left", borderaxespad=0, prop={'size':10}, )

	mm = np.array(m)
	lk = { year : { v : len(list (filter (lambda y:y==ind(year), hm[v]))) for v in krange } for year in years }
	for j,bc in enumerate(patches):
		for i,p in enumerate(bc):
			l = lk[years[i]][krange[j]]
			if l == 0:
				continue
			h1 = p.get_height()
			print ("{} {}".format(p,l))
			z = 100.0 * l / float(sum(lk[years[i]].values()))
			plt.text (p.get_x() + p.get_width() / 2., p.get_y() + h1 / 2., "%d%%" % int(z), ha="center", va="center", color="black", fontsize=8, fontweight="normal")
示例#9
0
        if i=='.':
            break
    ind= [x,array.index(i)]
    return ind
start = indexfinder(f[0])[0]
end = indexfinder(f[0])[1]
# i=66
z=[]
for j in range(0,len(f)):
        z+=[f[j][start:end]]

audio_files = f
len(audio_files)
count = 0
dir = 1
os.chdir('1')
for i in range(0,len(audio_files)):
    if count>59:
        dir+=1
        count=0
        os.chdir('..')
        os.chdir(str(dir))
    audio, sfreq = lr.load(audio_files[i])
    time = np.arange(0,len(audio))/sfreq
    plt.plot(time,audio)
    plt.set(xlabel = "Time (s)",ylabel = "Sound amplitude")
    plt.savefig(z[i]+".png")
    print("figue",i,"plotted")
    count+=1
    plt.close()
示例#10
0
import pandas as pd
from pandas import DataFrame

import datetime

import matplotlib.pyplot as plt
#from matplotlib import style
#style.use('ggplot')

df = pd.read_csv(
    'C:/Users/Andy/Desktop/mimic/csv/ADMISSIONS.csv/ADMISSIONS_DATA_TABLE.csv')
diagnoses = df['DIAGNOSIS']

#fill in missing data
for i in df['DIAGNOSIS']:
    if i != i:
        df['DIAGNOSIS'] = df['DIAGNOSIS'].fillna(value="MISSING")

#plotting SUBJECT_ID vs. DIAGNOSIS with Scatter Plot.
x, y = [i for i in df['SUBJECT_ID']], [j for j in df['DIAGNOSIS']]

plt.scatter(x, y, s=20, c='b')
plt.set(xticks=range(len(x)),
        xticklabels="SUBJECT ID",
        yticks=range(len(y)),
        yticklabels="DIAGNOSIS")
#plt.xticks (range(len(x)), x, align = 'center')
#plt.xyticks (range(len(y)), y, size = 'small')
plt.show()
示例#11
0
def distance_diff_size_plot(images_sentinel, images_naip):

    #right location experiment

    MSE_global_r = []
    SSIM_global_r = []

    for i in range(0, 20):
        #print(i)
        drone_url = images_sentinel[i]
        planet_url = images_naip[i]
        location = "TRUE"
        #response = requests.get(drone_url)
        drone_img = Image.open(drone_url)
        planet_img = Image.open(planet_url)
        planet_img = planet_img.convert('RGB')
        drone_img = drone_img.resize((512, 512))
        base_planet_img = planet_img.resize((512, 512))

        x_1 = []
        for i in range(1, 43):
            num = 12 * i
            if (num % 2) != 0:
                num = num + 1
            x_1.append(num)
            if i == 42:
                x_1.append(512)
        #print(x_1)

        if location == "TRUE":
            MSE_tt = []
            SSIM_tt = []
            for i in range(0, 43):
                if i in range(0, 42):
                    #print(i)
                    width = x_1[i] / 2
                    #print(width)
                    cropped_drone_img = drone_img.crop(
                        (256 - width, 256 - width, 256 + width, 256 + width))
                    #print("size",cropped_drone_img.size)
                    cropped_drone_img = drone_img.crop(
                        (256 - width, 256 - width, 256 + width,
                         256 + width)).resize((512, 512))
                    cropped_planet_img = base_planet_img.crop(
                        (256 - width, 256 - width, 256 + width,
                         256 + width)).resize((512, 512))
                    np_drone = np.array(cropped_drone_img)
                    np_planet = np.array(cropped_planet_img)
                    MSE = metrics.mean_squared_error(np_drone.flatten(),
                                                     np_planet.flatten())
                    MSE_tt.append(MSE)
                    SSIM = compare_ssim(cropped_drone_img, cropped_planet_img)
                    SSIM_tt.append(SSIM)
                else:
                    #print(i, "after 500")
                    if i == 43:
                        cropped_drone_img = cropped_drone_img.resize(
                            (512, 512))
                        cropped_planet_img = base_planet_img.resize((512, 512))
                    cropped_drone_img = cropped_drone_img.resize(
                        (i * 12, i * 12))
                    cropped_planet_img = base_planet_img.resize(
                        (i * 12, i * 12))
                    #print(cropped_planet_img.size)
                    np_drone = np.array(cropped_drone_img)
                    np_planet = np.array(cropped_planet_img)
                    MSE = metrics.mean_squared_error(np_drone.flatten(),
                                                     np_planet.flatten())
                    MSE_tt.append(MSE)
                    SSIM = compare_ssim(cropped_drone_img, cropped_planet_img)
                    SSIM_tt.append(SSIM)
            #print(len(MSE_global_r))
            SSIM_global_r.append(SSIM_tt)
            MSE_global_r.append(MSE_tt)

    #wrong location experiment

    import random

    location = "WRONG"

    MSE_global_wl = []
    SSIM_global_wl = []

    def rotate(l, n):
        return l[n:] + l[:n]

    for i in range(0, 20):
        drone_url = images_sentinel[i]
        images_naip_rot = rotate(images_naip, 2)
        planet_url = images_naip_rot[i]
        drone_img = Image.open(drone_url)
        planet_img = Image.open(planet_url)
        planet_img = planet_img.convert('RGB')
        drone_img = drone_img.resize((512, 512))
        base_planet_img = planet_img.resize((512, 512))

        x_1 = []
        for i in range(1, 43):
            num = 12 * i
            if (num % 2) != 0:
                num = num + 1
            x_1.append(num)
            if i == 42:
                x_1.append(512)

        if location == "WRONG":
            MSE_tt = []
            SSIM_tt = []
            for i in range(0, 43):
                if i in range(0, 42):
                    width = x_1[i] / 2
                    cropped_drone_img = drone_img.crop(
                        (256 - width, 256 - width, 256 + width, 256 + width))
                    cropped_drone_img = drone_img.crop(
                        (256 - width, 256 - width, 256 + width,
                         256 + width)).resize((512, 512))
                    cropped_planet_img = base_planet_img.crop(
                        (256 - width, 256 - width, 256 + width,
                         256 + width)).resize((512, 512))
                    np_drone = np.array(cropped_drone_img)
                    np_planet = np.array(cropped_planet_img)
                    MSE = metrics.mean_squared_error(np_drone.flatten(),
                                                     np_planet.flatten())
                    MSE_tt.append(MSE)
                    SSIM = compare_ssim(cropped_drone_img, cropped_planet_img)
                    SSIM_tt.append(SSIM)
                else:
                    if i == 43:
                        cropped_drone_img = cropped_drone_img.resize(
                            (512, 512))
                        cropped_planet_img = base_planet_img.resize((512, 512))
                    cropped_drone_img = cropped_drone_img.resize(
                        (i * 12, i * 12))
                    cropped_planet_img = base_planet_img.resize(
                        (i * 12, i * 12))
                    np_drone = np.array(cropped_drone_img)
                    np_planet = np.array(cropped_planet_img)
                    MSE = metrics.mean_squared_error(np_drone.flatten(),
                                                     np_planet.flatten())
                    MSE_tt.append(MSE)
                    SSIM = compare_ssim(cropped_drone_img, cropped_planet_img)
                    SSIM_tt.append(SSIM)
            MSE_global_wl.append(MSE_tt)
            SSIM_global_wl.append(SSIM_tt)

    import pandas as pd
    x_2 = [i * i for i in x_1]
    df_r = pd.DataFrame(MSE_global_r,
                        index=[
                            "image 1", "image 2", "image 3", "image 4",
                            "image 5", "image 6", "image 7", "image 8",
                            "image 9", "image 10", "image 11", "image 12",
                            "image 13", "image 14", "image 15", "image 16",
                            "image 17", "image 18", "image 19", "image 20"
                        ],
                        columns=x_2)
    tmp_df_r = df_r

    df_wl = pd.DataFrame(MSE_global_wl,
                         index=[
                             "image 1", "image 2", "image 3", "image 4",
                             "image 5", "image 6", "image 7", "image 8",
                             "image 9", "image 10", "image 11", "image 12",
                             "image 13", "image 14", "image 15", "image 16",
                             "image 17", "image 18", "image 19", "image 20"
                         ],
                         columns=x_2)
    tmp_df_wl = df_wl

    A_r = []

    for k in tmp_df_r.keys():
        row_df = tmp_df_r[k]
        #row_df_wt = tmp_df_wt[k]
        row_df_wl = tmp_df_wl[k]
        for row in row_df.index:
            a = [row, float(row_df[row]), float(k), "rl"]
            #b = [row, float(row_df_wt[row]), float(k), "wt-rl"]
            c = [row, float(row_df_wl[row]), float(k), "wl"]
            A_r += [a]
            #A_r += [b]
            A_r += [c]

    new_pd_r = pd.DataFrame(
        A_r, columns=["Image", "Distance", "Area", "Experiment"])

    import matplotlib.pyplot as plt
    import seaborn as sns
    plt = sns.lineplot(x="Area",
                       y="Distance",
                       hue="Experiment",
                       data=new_pd_r,
                       palette=["g", "r"])
    plt.ticklabel_format(style='sci', axis='x', scilimits=(0, 0))
    plt.set(xlabel="Area in $m^2$", ylabel='MSE')
示例#12
0
    plt.xlabel('pattern width (\circ)');
    plt.ylabel('spatial res. (\circ)');
    plt.grid on; grid minor;
    plt.legend(patterns);
    pdfsave(3, sprintf('patterncomp_#d_#s_width.pdf', ratio, acc_type));
    f.plt.savefig("foo.pdf", bbox_inches='tight') # save 1 page PDF
                       
    plt.figure(4); pyplot.clf(); hold on;
    for j = np.linspace(1,len(x)):
        plt.plot(x{j}, y{j});
    plt.xlabel('spatial res. (\circ)');
    plt.ylabel('uncertainty (\circ)');
    plt.grid on; plt.grid minor;
    plt.legend(patterns);
    pdfsave(4, print('patterncomp_#d_#s.pdf', ratio, acc_type));
    
    ## sub functions
    function pdfsave(fignum, filename)
        # Saves figure to pdf
        fh = plt.figure(fignum);
    
        plt.set(fh, 'Units', 'centimeters');
        pos = plt.get(fh, 'Position');
        plt.set(fh, 'PaperPositionMode', 'Auto', 'PaperUnits', 'centimeters', 'PaperSize', [pos(3), pos(4)]);
    
        plt.set(fh, 'renderer', 'painters');
        print(fh, '-dpdf', '-r1200', filename);
        disp(['Saved figure ' num2str(fignum) ' to ' filename]);
        
        plt.show()
df = pd.read_csv(
    "C:/Users/PC/Downloads/archivos_base_python_data_science_big_data_esencial/base_datos_2008.csv",
    nrows=100000)

data = np.unique(df.DayOfWeek, return_counts=True)
labs = ["Lun", "Mar", "Mie", "Jue", "Vie", "Sab", "Dom"]
data

# In[5]:

plt.pie(
    x=data[1],
    labels=labs,
    radius=0.7,
    colors=sns.color_palette(
        "hls", 7
    ),  #Comando para indicar que son 7 colores y que use una paleta definida en sns
    explode=(0, 0, 0, 0, 0, 0,
             0.1),  #Resalta o aleja los valores en el grafico
    startangle=90,
    autopct="%1.1f%%")  #Muestra los valores en formato float

plt.legend(loc="upperleft",
           labels=labs)  #Ubica la legenda en la parte que desees
plt.show()

# In[7]:

plt = sns.barplot(x=labs, y=data[1])
plt.set(xlabel="Dia de la semana", ylabel="Numero de vuelos")
示例#14
0
    system(['cat ' + os.path.join(datadir,summfile) + ' ' + os.path.join(datadir,parsfile) + ' > ' + os.path.join(datadir,allfile)])


os.remove(os.path.join(datadir,summfile))
os.remove(os.path.join(datadir,parsfile))
'''
%-------------------------------------------------------------------------------------
% CREATE FIGURES IF SO DESIRED
%-------------------------------------------------------------------------------------
'''
if GPSFigs:
    figname = filename + '-parsed-fig'
    
    #%-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
    
    fig1 = plt.figure('Position',[10, 50, 600, 900],'PaperUnits','inches','PaperPosition',\
         [0.5,0.5,7,10])
    plt.subplot(2, 1, 1)
    plt.plot(MsgPCntrs[1,range(1, pidx)], '-bo', 'MarkerFaceColor', 'b', 'MarkerSize',3)
    plt.xlabel('MSG ID 3 Count', 'FontSize', 12, 'FontWeight', 'demi')
    plt.ylabel('Number of Msg. 3500 per Msg. 3', 'FontSize', 12, 'FontWeight', 'demi')
    plt.title(filename, 'Interpreter', 'none', 'FontSize', 14, 'FontWeight', 'demi')
    plt.set(gca, 'PlotBoxAspectRatio', [1.5, 1, 1], 'TickLength', [.02, .02],\
            'XMinorTick', 'on', 'YMinorTick', 'on', 'YDir', 'normal')
    plt.subplot(2,1,2)
    plt.plot(MsgPCntrs[2,range(1, pidx)], '-ro', 'MarkerFaceColor', 'r', 'MarkerSize',3)
    plt.xlabel('MSG ID 3 Count', 'FontSize', 12, 'FontWeight', 'demi')
    plt.ylabel('Number of Msg. 3501 per Msg. 3', 'FontSize', 12, 'FontWeight', 'demi')
    plt.title(filename, 'Interpreter', 'none', 'FontSize', 14, 'FontWeight', 'demi')
    plt.set(gca, 'PlotBoxAspectRatio', [1.5, 1, 1], 'TickLength', [.02, .02],\
            'XMinorTick', 'on', 'YMinorTick', 'on', 'YDir', 'normal')
def plot_n_pixel_attack_randomly_vs_directly(
        plt, type_of_attack
):  # simard = M1, ann-keras = m2, simple= m3, deepcheck = m4
    # when not using sample ranking algorithm
    num_adv_arr, total_samples = analyze_randomly(
        f'/Users/ducanhnguyen/Documents/mydeepconcolic/result/{type_of_attack}/result/mnist_simard/summary.csv'
    )
    if total_samples is not None and num_adv_arr is not None:
        plt.plot(total_samples,
                 num_adv_arr,
                 '-k',
                 linewidth=1,
                 label='M1 (random)')

    num_adv_arr, total_samples = analyze_randomly(
        f'/Users/ducanhnguyen/Documents/mydeepconcolic/result/{type_of_attack}/result/mnist_ann_keras/summary.csv'
    )
    if total_samples is not None and num_adv_arr is not None:
        plt.plot(total_samples,
                 num_adv_arr,
                 '-sk',
                 linewidth=1,
                 markevery=250,
                 markersize=3,
                 label='M2 (random)')

    num_adv_arr, total_samples = analyze_randomly(
        f'/Users/ducanhnguyen/Documents/mydeepconcolic/result/{type_of_attack}/result/mnist_simple/summary.csv'
    )
    if total_samples is not None and num_adv_arr is not None:
        plt.plot(total_samples,
                 num_adv_arr,
                 '->k',
                 linewidth=1,
                 markevery=250,
                 markersize=3,
                 label='M3 (random)')

    num_adv_arr, total_samples = analyze_randomly(
        f'/Users/ducanhnguyen/Documents/mydeepconcolic/result/{type_of_attack}/result/mnist_deepcheck/summary.csv'
    )
    if total_samples is not None and num_adv_arr is not None:
        plt.plot(total_samples,
                 num_adv_arr,
                 '-.k',
                 linewidth=1,
                 label='M4 (random)')

    # when using sample ranking algorithm
    num_adv_arr, total_samples, threshold_arr = analyze_by_threshold(
        f'/Users/ducanhnguyen/Documents/mydeepconcolic/result/{type_of_attack}/result/mnist_simard/summary.csv'
    )
    if total_samples is not None and num_adv_arr is not None:
        plt.plot(total_samples,
                 num_adv_arr,
                 '-g',
                 linewidth=1,
                 label='M1 (ranking)')

    num_adv_arr, total_samples, threshold_arr = analyze_by_threshold(
        f'/Users/ducanhnguyen/Documents/mydeepconcolic/result/{type_of_attack}/result/mnist_ann_keras/summary.csv'
    )
    if total_samples is not None and num_adv_arr is not None:
        plt.plot(total_samples,
                 num_adv_arr,
                 '-sg',
                 linewidth=1,
                 markevery=0.05,
                 markersize=3,
                 label='M2 (ranking)')

    num_adv_arr, total_samples, threshold_arr = analyze_by_threshold(
        f'/Users/ducanhnguyen/Documents/mydeepconcolic/result/{type_of_attack}/result/mnist_simple/summary.csv'
    )
    if total_samples is not None and num_adv_arr is not None:
        plt.plot(total_samples,
                 num_adv_arr,
                 '->g',
                 linewidth=1,
                 markevery=0.05,
                 markersize=3,
                 label='M3 (ranking)')

    num_adv_arr, total_samples, threshold_arr = analyze_by_threshold(
        f'/Users/ducanhnguyen/Documents/mydeepconcolic/result/{type_of_attack}/result/mnist_deepcheck/summary.csv'
    )
    if total_samples is not None and num_adv_arr is not None:
        plt.plot(total_samples,
                 num_adv_arr,
                 '-.g',
                 linewidth=1,
                 label='M4 (ranking)')

    plt.set(xlabel="% attacking samples", ylabel="# adversarial examples")