Esempio n. 1
0
def plot_bar_chart(x_axis,freq,unit,category,rota,font,path):
    
    plt.figure(figsize=(26,15))
    plt.bar(range(len(freq)),freq, align='center',width=1,color='r')
    plt.xticks(range(len(x_axis)),x_axis,size='small',fontsize=font,rotation=rota)#size='small'
    plt.yticks(fontsize=font)
    
    if unit=="Ratio":
        plt.xlabel("VIDEO")
        plt.ylabel('RATIO (%)')
        axes = plt.gca()
        axes.set_ylim([0,100])
    else:
        plt.xlabel(unit)
        plt.ylabel('Frequency (# Videos)')
        
    plt.title("Histogram of "+category+" : "+unit)
    plt.autoscale(True)
    plt.get_scale_names()
    plt.grid(True)
    figManager = plt.get_current_fig_manager()
    figManager.window.showMaximized()
    plt.savefig(path,papertype='letter',orientation='landscape')
    plt.show()
    plt.close()
    
    
    
    
    
    return
Esempio n. 2
0
def plot_bar_chart(x_axis, freq, unit, category, rota, font, path):

    plt.figure(figsize=(26, 15))
    plt.bar(range(len(freq)), freq, align='center', width=1, color='r')
    plt.xticks(range(len(x_axis)),
               x_axis,
               size='small',
               fontsize=font,
               rotation=rota)  #size='small'
    plt.yticks(fontsize=font)

    if unit == "Ratio":
        plt.xlabel("VIDEO")
        plt.ylabel('RATIO (%)')
        axes = plt.gca()
        axes.set_ylim([0, 100])
    else:
        plt.xlabel(unit)
        plt.ylabel('Frequency (# Videos)')

    plt.title("Histogram of " + category + " : " + unit)
    plt.autoscale(True)
    plt.get_scale_names()
    plt.grid(True)
    figManager = plt.get_current_fig_manager()
    figManager.window.showMaximized()
    plt.savefig(path, papertype='letter', orientation='landscape')
    plt.show()
    plt.close()

    return
 def graph(self):
     plt.plot(self.time,self.price)
     plt.get_scale_names()
     plt.title(self.coin+'price')
     plt.xlabel('time in second')
     plt.ylabel('price in '+self.convert_to.upper())
     plt.show()
Esempio n. 4
0
def calc_hist_bitrate(bitrate, path, title):

    bitrate = np.array(bitrate)
    bitrate = map(int, bitrate)
    bitrate_nozeros = eliminate_value(0, bitrate)
    xmax = max(bitrate_nozeros)
    xmin = min(bitrate_nozeros)
    rang = xmax - xmin
    """
    STURGES's LAW:

    log(N)*3.322 + 4  round to closest integer 
    19=#bins

    """
    bins = int(round(np.log10(len(bitrate_nozeros)) * 3.322 + 4))
    step = rang / bins
    bins_array = np.linspace(xmin, xmax, (xmax - xmin) / step)
    bins_array = np.around(bins_array, decimals=0)
    bins_array = map(int, bins_array)

    #Compute Histogram
    bit_hist, bit_bin = np.histogram(bitrate_nozeros, bins=bins_array)

    plt.figure(figsize=(26, 15))
    plt.bar(range(len(bit_hist)), bit_hist, align='center', width=1, color='r')
    plt.xticks(range(len(bins_array)),
               bins_array,
               size='small',
               fontsize=12,
               rotation="horizontal")  #size='small'
    plt.yticks(fontsize=12)
    axes = plt.gca()
    axes.set_xlim([min(bins_array), max(bins_array)])
    axes.set_ylim([min(bit_hist), max(bit_hist)])
    plt.title("Histogram of " + str(title) + " :  Bitrate (KBPS)")
    plt.xlabel("BINS (KBPS)")
    plt.ylabel('Frequency (#Videos)')
    plt.autoscale(True)
    plt.get_scale_names()
    plt.grid(True)
    figManager = plt.get_current_fig_manager()
    figManager.window.showMaximized()
    plt.savefig(path, papertype='letter', orientation='landscape')
    plt.show()
    plt.close()

    return
Esempio n. 5
0
def calc_hist_bitrate (bitrate,path,title):

    bitrate=np.array(bitrate)
    bitrate=map(int, bitrate)
    bitrate_nozeros=eliminate_value(0,bitrate)
    xmax=max(bitrate_nozeros)
    xmin=min(bitrate_nozeros)
    rang=xmax-xmin
    
    """
    STURGES's LAW:

    log(N)*3.322 + 4  round to closest integer 
    19=#bins

    """
    bins=int (round (np.log10(len(bitrate_nozeros))*3.322 + 4))
    step=rang/bins
    bins_array=np.linspace(xmin, xmax, (xmax-xmin)/step)
    bins_array=np.around(bins_array,decimals=0)
    bins_array=map(int,bins_array)
    
    #Compute Histogram
    bit_hist,bit_bin=np.histogram(bitrate_nozeros,bins=bins_array)
    
    plt.figure(figsize=(26,15))
    plt.bar(range(len(bit_hist)),bit_hist, align='center',width=1,color='r')
    plt.xticks(range(len(bins_array)),bins_array,size='small',fontsize=12,rotation="horizontal")#size='small'
    plt.yticks(fontsize=12)
    axes = plt.gca()
    axes.set_xlim([min(bins_array),max(bins_array)])
    axes.set_ylim([min(bit_hist),max(bit_hist)])
    plt.title("Histogram of "+str(title)+" :  Bitrate (KBPS)")
    plt.xlabel("BINS (KBPS)")
    plt.ylabel('Frequency (#Videos)')
    plt.autoscale(True)
    plt.get_scale_names()
    plt.grid(True)
    figManager = plt.get_current_fig_manager()
    figManager.window.showMaximized()
    plt.savefig(path,papertype='letter',orientation='landscape')
    plt.show()
    plt.close()
    
    return