Write histogram to an open ROOT file.

    Parameters
    ----------
    histogram : Any histogram
    hfile : Updateable uproot file object
    name : The name of the histogram inside the file
348084
def write_root(histogram: HistogramBase, hfile: uproot.write.TFile.TFileUpdate, name: str):
    
    hfile[name] = histogram
1170373
def histogram(self, column='r', filename=None, log10=False, **kwargs):
        """"""
        return_dict = HS.plot_histograms(self.data, column)
        if filename is not None:
            return_dict['all'].savefig(filename, dpi=300)
        return return_dict
168820
def writeto(self, filename, **kwargs):
        
        fits.PrimaryHDU(header=self).writeto(filename, output_verify='ignore', **kwargs)
1080396
def _write(self, session, openFile, replaceParamFile):
        
        # Write lines
        openFile.write(text(self.projection))
433595
def write_file(self, filename, contents):
        
        logger.info("Writing file: %s", format_path(filename))
        contents = contents.rstrip() + b"\n"
        self.context.write_file(filename, contents)
        logger.debug("Wrote %s to %s.",
                     pluralize(len(contents.splitlines()), "line"),
                     format_path(filename))
856628
def write(self, outfile):
        """"""

        hdu_pri = fits.PrimaryHDU()

        hdu_exp = self._create_exp_hdu(self.data)
        hdu_exp.name = 'EXPOSURE'
        hdu_exp_wt = self._create_exp_hdu(self._data_wt)
        hdu_exp_wt.name = 'WEIGHTED_EXPOSURE'

        cols = [Column(name='CTHETA_MIN', dtype='f4',
                       data=self.costh_edges[:-1][::-1]),
                Column(name='CTHETA_MAX',  dtype='f4',
                       data=self.costh_edges[1:][::-1]), ]
        hdu_bnds = fits.table_to_hdu(Table(cols))
        hdu_bnds.name = 'CTHETABOUNDS'

        hdu_gti = fits.table_to_hdu(self._tab_gti)
        hdu_gti.name = 'GTI'

        hdus = [hdu_pri, hdu_exp, hdu_exp_wt,
                hdu_bnds, hdu_gti]

        for hdu in hdus:
            hdu.header['TSTART'] = self.tstart
            hdu.header['TSTOP'] = self.tstop

        with fits.HDUList(hdus) as hdulist:
            hdulist.writeto(outfile, clobber=True)
737802
def _write_file_iface(iface, data, folder, pattern):
    '''
    
    '''
    filename = os.path.join(folder, pattern.format(iface))
    if not os.path.exists(folder):
        msg = '{0} cannot be written. {1} does not exist'
        msg = msg.format(filename, folder)
        log.error(msg)
        raise AttributeError(msg)
    with salt.utils.files.fopen(filename, 'w') as fp_:
        fp_.write(salt.utils.stringutils.to_str(data))
17929
def _histogram_data(iterator):
    
    histogram_started = False
    header_passed = False
    for l in iterator:
        if '## HISTOGRAM' in l:
            histogram_started = True
        elif histogram_started:
            if header_passed:
                values = l.rstrip().split("\t")
                problem_type, name = values[0].split(':')
                yield problem_type, name, int(values[1])
            elif l.startswith('Error Type'):
                header_passed = True
1046584
def save(root_node, filename)
      # TODO: - accept any I/O object?
      stringify_tree_from root_node
      File.open(filename, 'w') {|f| f << @sgf}
    end
535677
def histogram(title, title_x, title_y,
              x, bins_x):
    
    plt.figure()
    plt.hist(x, bins_x)
    plt.xlabel(title_x)
    plt.ylabel(title_y)
    plt.title(title)
482371
def write(self, session, directory, name, replaceParamFile=None, **kwargs):
        
        if self.raster is not None or self.rasterText is not None:
            super(RasterMapFile, self).write(session, directory, name, replaceParamFile, **kwargs)
612026
def write_hdf5_cells(E, filename):
    ''' '''

    E = E.tocsr()

    hf = h5py.File(filename, 'w')
    counts_group = hf.create_group('counts')
    gix_group = hf.create_group('gene_ix')

    hf.attrs['ncells'] = E.shape[0]
    hf.attrs['ngenes'] = E.shape[1]

    for iC in range(E.shape[0]):
        counts = E[iC,:].A.squeeze()
        gene_ix = np.nonzero(counts)[0]
        counts = counts[gene_ix]
        counts_group.create_dataset(str(iC), data = counts)
        gix_group.create_dataset(str(iC), data = gene_ix)

    hf.close()
885678
def write_source(self, filename):
        '''
        
        '''
        return self.message._elem.getroottree().write(filename, encoding='utf8')
1181593
def write_to_file(self, filename):
        
        fid = open(filename, 'w')

        for key in self.key_order:
            if(key == -1):
                fid.write('\n')
            else:
                fid.write('{0}\n'.format(self[key]))

        fid.close()
569392
def _write_file(self, filename, data):
        

        if self.__compression:
            f = gzip.GzipFile(filename, "wb")
        else:
            f = open(filename, "wb")
        pickle.dump(data, f, pickle.HIGHEST_PROTOCOL)
        f.close()
1227543
def push_header(self, filename):
        
        # open file and read it all
        with open(filename, "r") as infile:
            content = infile.read()

        # push header
        content = self.__header + content

        # re-write file with the header
        with open(filename, "w") as outfile:
            outfile.write(content)
552780
def create_histogram(df):
    
    fig = Figure("/mg/histogram/", "mg_histogram")
    fig.layout.set_size(width=450, height=200)
    fig.layout.set_margin(left=40, right=40)
    fig.graphics.animate_on_load()

    # Make a histogram with 20 bins
    return Histogram(df, fig, "value", 20, init_params={"Data": "Steps"})