def totalComming(res,plotFileName='TotalCommingAllGroups.svg'): data = dict() plotName = [] for roc in res: data[roc[0]] = roc[1] cairoplot.pie_plot(plotFileName, data, 1920, 1080) print "wrote",plotFileName
def totalComming(res, plotFileName='TotalCommingAllGroups.svg'): data = dict() plotName = [] for roc in res: data[roc[0]] = roc[1] cairoplot.pie_plot(plotFileName, data, 1920, 1080) print "wrote", plotFileName
def MakeGraphPercent(self, Data, FileName): """ Funzione che produce un grafico percentuale sotto forma di pieplot. :param Data: Dato da dover graficare. :param FileName: Nome file da assegnare al grafico prodotto. :returns: *nulla* """ global Interval Labels = ["%IN USO","TOT"] FileName = 'extra/MonitorGraph/'+FileName #print "**Data Graph**" #print Data #selezione della combinazione di colori per i grafici percentuali, a soglie [0,33],[34,66],[67,100] if (Data <= 33): PercentColors = ["lime","gray"] elif (Data <= 66): PercentColors = ["yellow","light_gray"] else : PercentColors = ["red","white"] Data = [int(Data),100-int(Data)] #ogni volta cerca di acquisire il lock per creare una nuova immagine, se non riesce, rompe il lock TempLock = FileLock(FileName) try: TempLock.acquire(timeout=Interval) except LockTimeout: TempLock.break_lock() else: cairoplot.pie_plot(FileName, dict(zip(Labels,Data)), 185, 130, colors = PercentColors) TempLock.release()
def groupPieWorker(name,data,groupStats='Statistics.svg'): plotFileName = name + groupStats colors = [colorRed, colorYellow , colorGreen] cairoplot.pie_plot(plotFileName, data, 1920, 1080,colors = colors) print "wrote",plotFileName
#Stack horizontal data = Series([ [6, 4, 10], [8, 9, 3], [1, 10, 9], [2, 7, 11] ]) colors = [ (1,0.2,0), (1,0.7,0), (1,1,0) ] y_labels = ["teste1", "teste2", "testegrande3", "testegrande4"] cairoplot.horizontal_bar_plot ( 'hbar_10_stack_series.png', data, 400, 300, border = 20, display_values = True, grid = True, rounded_corners = True, stack = True, y_labels = y_labels, colors = colors ) if test_pie_plot : #Define a new backgrond background = cairo.LinearGradient(300, 0, 300, 400) background.add_color_stop_rgb(0.0,0.7,0.0,0.0) background.add_color_stop_rgb(1.0,0.3,0.0,0.0) #Plot data data = {"orcs" : 100, "goblins" : 230, "elves" : 50 , "demons" : 43, "humans" : 332} cairoplot.pie_plot( "pie_1_default_series.png", data, 600, 400 ) cairoplot.pie_plot( "pie_2_gradient_shadow_series.png", data, 600, 400, gradient = True, shadow = True ) cairoplot.pie_plot( "pie_3_background_series.png", data, 600, 400, background = background, gradient = True, shadow = True ) if test_donut_plot : #Define a new backgrond background = cairo.LinearGradient(300, 0, 300, 400) background.add_color_stop_rgb(0,0.4,0.4,0.4) background.add_color_stop_rgb(1.0,0.1,0.1,0.1) data = {"john" : 700, "mary" : 100, "philip" : 100 , "suzy" : 50, "yman" : 50} #Default plot, gradient and shadow, different background cairoplot.donut_plot( "donut_1_default_series.png", data, 600, 400, inner_radius = 0.3 ) cairoplot.donut_plot( "donut_2_gradient_shadow_series.png", data, 600, 400, gradient = True, shadow = True, inner_radius = 0.3 ) cairoplot.donut_plot( "donut_3_background_series.png", data, 600, 400, background = background, gradient = True, shadow = True, inner_radius = 0.3 )
#Stack horizontal data = [ [6, 4, 10], [8, 9, 3], [1, 10, 9], [2, 7, 11] ] colors = [ (1,0.2,0), (1,0.7,0), (1,1,0) ] y_labels = ["teste1", "teste2", "testegrande3", "testegrande4"] cairoplot.horizontal_bar_plot ( 'hbar_10_stack.svg', data, 400, 300, border = 20, display_values = True, grid = True, rounded_corners = True, stack = True, y_labels = y_labels, colors = colors ) if test_pie_plot : #Define a new backgrond background = cairo.LinearGradient(300, 0, 300, 400) background.add_color_stop_rgb(0.0,0.7,0.0,0.0) background.add_color_stop_rgb(1.0,0.3,0.0,0.0) #Plot data data = {"orcs" : 100, "goblins" : 230, "elves" : 50 , "demons" : 43, "humans" : 332} cairoplot.pie_plot( "pie_1_default.svg", data, 600, 400 ) cairoplot.pie_plot( "pie_2_gradient_shadow.svg", data, 600, 400, gradient = True, shadow = True ) cairoplot.pie_plot( "pie_3_background.svg", data, 600, 400, background = background, gradient = True, shadow = True ) if test_donut_plot : #Define a new backgrond background = cairo.LinearGradient(300, 0, 300, 400) background.add_color_stop_rgb(0,0.4,0.4,0.4) background.add_color_stop_rgb(1.0,0.1,0.1,0.1) data = {"john" : 700, "mary" : 100, "philip" : 100 , "suzy" : 50, "yman" : 50} #Default plot, gradient and shadow, different background cairoplot.donut_plot( "donut_1_default.svg", data, 600, 400, inner_radius = 0.3 ) cairoplot.donut_plot( "donut_2_gradient_shadow.svg", data, 600, 400, gradient = True, shadow = True, inner_radius = 0.3 ) cairoplot.donut_plot( "donut_3_background.svg", data, 600, 400, background = background, gradient = True, shadow = True, inner_radius = 0.3 )
def groupPieWorker(name, data, groupStats='Statistics.svg'): plotFileName = name + groupStats colors = [colorRed, colorYellow, colorGreen] cairoplot.pie_plot(plotFileName, data, 1920, 1080, colors=colors) print "wrote", plotFileName
latency += 1 ## Sleep efficiency determination and annotation of the classified dataset efficiency = N.sum(count)/N.size(count) labels = 'Sleep', 'Wake' fracs = [efficiency, 1-efficiency] ## Report string for sleep efficiency (SE) and sleep onset latency (SOL) report = 'SE: ' + str(100*efficiency) + '; SOL: ' + str(latency) + ' minutes' ## Use cairoplot to generate some quick plots of the sleep data background=cairo.LinearGradient(300,0,300,400) background.add_color_stop_rgb(0.0, .54, .54, .54) background.add_color_stop_rgb(1.0, .24, .24, .24) data = {"SLEEP": float(efficiency) , "WAKE": float(1-efficiency)} print("Efficiency: " + str(efficiency) + " and ~Eff: " + str(1-efficiency)) cairoplot.pie_plot("SleepEfficiency.png", data, 400, 400, gradient=True, shadow=True, background=background) users={ "none": user, "none2":[0],"sleep": [0]} cairoplot.dot_line_plot("SleepWake.png", users, 400, 400, axis=True, grid=True, y_title='Sleep=1; Wake=0', x_title=report, y_bounds=(0,1.11), background=background) #py.figure(1, figsize=(6,6)) #ax = py.axes([0.1, 0.1, 0.8, 0.8]) #py.pie(fracs, labels=labels, autopct='%1.1f%%', shadow=True) #py.title('Sleep Efficiency with ' + report) #py.axis([0,N.size(user), 0, 1.2]) #py.grid(True) #py.show() #classifier(e)
if test_pie_plot: #Define a new backgrond background = cairo.LinearGradient(300, 0, 300, 400) background.add_color_stop_rgb(0.0, 0.7, 0.0, 0.0) background.add_color_stop_rgb(1.0, 0.3, 0.0, 0.0) #Plot data data = { "orcs": 100, "goblins": 230, "elves": 50, "demons": 43, "humans": 332 } cairoplot.pie_plot("pie_1_default.svg", data, 600, 400) cairoplot.pie_plot("pie_2_gradient_shadow.svg", data, 600, 400, gradient=True, shadow=True) cairoplot.pie_plot("pie_3_background.svg", data, 600, 400, background=background, gradient=True, shadow=True) if test_donut_plot:
except AttributeError: #print("Found no EXIF header... Skipping picture %s"%full_file) print(".") print("Cameras: %s\n"%camera_dict) print("Apertures: %s\n"%aperture_dict) print("Exposures: %s\n"%exposure_dict) print("Focallength: %s\n"%focallength_dict) print("ISOs: %s\n"%iso_dict) print("Years: %s\n"%year_dict) print("Month: %s\n"%month_dict) print("Day: %s\n"%day_dict) write_csv_from_dict(camera_dict, "cameras.csv") write_csv_from_dict(iso_dict, "iso.csv") #Define a new backgrond background = cairo.LinearGradient(300, 0, 300, 400) background.add_color_stop_rgb(0.0,0.0,0.0,0.0) background.add_color_stop_rgb(0.7,0.7,0.7,0.7) cairoplot.pie_plot("cameras", camera_dict, 700, 700, background = background, gradient = True, shadow = True) cairoplot.pie_plot("apertures", aperture_dict, 500, 500, background = background, gradient = True, shadow = True) cairoplot.pie_plot("exposures", exposure_dict, 500, 500, background = background, gradient = True, shadow = True) cairoplot.pie_plot("focallength", focallength_dict, 500, 500, background = background, gradient = True, shadow = True) cairoplot.pie_plot("iso", iso_dict, 500, 500, background = background, gradient = True, shadow = True) cairoplot.pie_plot("day", day_dict, 500, 500, background = background, gradient = True, shadow = True) cairoplot.pie_plot("year", year_dict, 500, 500, background = background, gradient = True, shadow = True) cairoplot.pie_plot("month", month_dict, 500, 500, background = background, gradient = True, shadow = True)
print("Years: %s\n" % year_dict) print("Month: %s\n" % month_dict) print("Day: %s\n" % day_dict) write_csv_from_dict(camera_dict, "cameras.csv") write_csv_from_dict(iso_dict, "iso.csv") #Define a new backgrond background = cairo.LinearGradient(300, 0, 300, 400) background.add_color_stop_rgb(0.0, 0.0, 0.0, 0.0) background.add_color_stop_rgb(0.7, 0.7, 0.7, 0.7) cairoplot.pie_plot("cameras", camera_dict, 700, 700, background=background, gradient=True, shadow=True) cairoplot.pie_plot("apertures", aperture_dict, 500, 500, background=background, gradient=True, shadow=True) cairoplot.pie_plot("exposures", exposure_dict, 500, 500, background=background,