Example #1
0
def display_pair_plot(fileName=None):

    #consider two versions of the data :
    #dict the whole dataset with keys = columns names, values = list columns values
    #dict_per_house with only columns of interest (with marks), keys = column name, val = dict with key = house, values = columns values for this house
    dict = getDataSet(fileName)
    dict_per_house = distribute_per_house(dict)

    #n_rows is the number of key ie the number of courses
    n_rows = len(dict_per_house)

    #we define a big structure for the plot
    f, ax = plt.subplots(n_rows, n_rows, figsize=(50, 75))

    list_keys = list(dict_per_house.keys())

    #we scan all keys
    for i in range(n_rows):
        for j in range(n_rows):
            #x_name is the name of the course x
            #y_name is the name of the course y
            x_name = list_keys[i]
            y_name = list_keys[j]

            #if different, we plot a scatter plot
            if (x_name != y_name):
                plot_scatter(ax[i, j], x_name, y_name, dict_per_house)
            #if identical, we plot an histogram
            if (x_name == y_name):
                plot_hist(ax[i, j], x_name, dict, dict_per_house, 50)
    plt.tight_layout()
    #we save the final plot in a .png file
    f.savefig("pair_plot.png")
Example #2
0
File: main.py Project: daix6/DIP
def test_equalize_hist(filename, dist):
  im = Image.open(filename)
  result = equalize_hist(im)
  out_path = os.path.join(dist, 'equalized.png')
  result.save(out_path)
  print 'The equalized image has been saved to %s.' % out_path
  # new histogram
  plot_hist(result, os.path.join(dist, 'equalized_hist.png'))
Example #3
0
def hist_tot(feature_dico, feature_list, b, house_colors):
    l = 0
    m = 0
    fig = plt.figure(figsize=(20, 10), dpi=100)
    grid = gridspec.GridSpec(4, 4)
    for k in range(len(feature_list)):
        xy_dico = freq_per_house(feature_dico[feature_list[k]], b)
        if k < 4:
            l = k
        else:
            m = k // 4
            l = k - 4 * m
        plt.subplot(grid[m, l])
        plot_hist(feature_dico, feature_list[k], b, house_colors)
        plt.title(feature_list[k])
        plt.legend(ncol=2, fontsize='x-small')
    plt.tight_layout()
    plt.show(block=True)
Example #4
0
def pair_plot(feature_dico, feature_list, house_colors):
    n = len(feature_list)
    fig = plt.figure(figsize=(15, 15), dpi=100)
    grid = gridspec.GridSpec(n, n)
    for k in range(n):
        for l in range(n):
            plt.subplot(grid[k, l])
            if k == l:
                plot_hist(feature_dico, feature_list[k], 20, house_colors)
                if k == 0:
                    plt.legend(ncol=2, fontsize='x-small')
            else:
                plot = scatter_plot(feature_dico, feature_list[k],
                                    feature_list[l], house_colors)
            if k == 0:
                plt.title(feature_list[l])
            if l == 0:
                plt.ylabel(feature_list[k])
    plt.tight_layout()
    plt.show(block=True)
Example #5
0
File: main.py Project: daix6/DIP
def test_plot_hist(filename, dist):
  im = Image.open(filename)
  plot_hist(im, os.path.join(dist, 'hist.png'))