def plot_host_domain_tld(self): # -- pages/URLs per host / domain / tld data = self.histogr data = data[data['type'].isin(['host', 'domain', 'tld'])] data = data[data['type_counted'].isin(['url'])] img_path = os.path.join(PLOTDIR, 'crawler/histogr_host_domain_tld.png') # data.to_csv(img_path + '.csv') title = 'URLs per Host / Domain / TLD' p = ggplot2.ggplot(data) \ + ggplot2.aes_string(x='count', weight='frequency', color='type') \ + ggplot2.geom_freqpoly(bins=20) \ + ggplot2.facet_wrap('crawl', ncol=4) \ + ggplot2.labs(title='', x=title, y='Frequency') \ + ggplot2.scale_y_log10() \ + ggplot2.scale_x_log10() p.save(img_path) return p
grdevices.dev_off() grdevices.png('../../_static/graphics_ggplot2geomfreqpolyfillcyl.png', width=812, height=412, antialias="subpixel", type="cairo") grid.newpage() grid.viewport(layout=grid.layout(1, 2)).push() gp = ggplot2.ggplot(dataf_rnorm) vp = grid.viewport(**{'layout.pos.col': 1, 'layout.pos.row': 1}) pp = gp + \ ggplot2.aes_string(x='value', col='factor(mean)') + \ ggplot2.geom_freqpoly() pp.plot(vp=vp) vp = grid.viewport(**{'layout.pos.col': 2, 'layout.pos.row': 1}) #-- ggplot2geomfreqpolyfillcyl-begin pp = gp + \ ggplot2.aes_string(x='value', fill='factor(mean)') + \ ggplot2.geom_density(alpha = 0.5) #-- ggplot2geomfreqpolyfillcyl-end pp.plot(vp=vp) grdevices.dev_off() grdevices.png('../../_static/graphics_ggplot2geompointandrug.png', width=612, height=612,
pp.plot() #-- ggplot2geompointdensity2d-end grdevices.dev_off() grdevices.png('../../_static/graphics_ggplot2geomfreqpolyfillcyl.png', width = 812, height = 412, antialias="subpixel", type="cairo") grid.newpage() grid.viewport(layout=grid.layout(1, 2)).push() gp = ggplot2.ggplot(dataf_rnorm) vp = grid.viewport(**{'layout.pos.col':1, 'layout.pos.row': 1}) pp = gp + \ ggplot2.aes_string(x='value', col='factor(mean)') + \ ggplot2.geom_freqpoly() pp.plot(vp = vp) vp = grid.viewport(**{'layout.pos.col':2, 'layout.pos.row': 1}) #-- ggplot2geomfreqpolyfillcyl-begin pp = gp + \ ggplot2.aes_string(x='value', fill='factor(mean)') + \ ggplot2.geom_density(alpha = 0.5) #-- ggplot2geomfreqpolyfillcyl-end pp.plot(vp = vp) grdevices.dev_off() grdevices.png('../../_static/graphics_ggplot2geompointandrug.png',