Python plotly.graph_objs.Histogram() Examples

The following are 10 code examples of plotly.graph_objs.Histogram(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module plotly.graph_objs , or try the search function .
Example #1
Source File: nanoplotter_main.py    From NanoPlot with GNU General Public License v3.0 6 votes vote down vote up
def plotly_histogram(array, color="#4CB391", title=None, xlabel=None, ylabel=None):
    data = [go.Histogram(x=array,
                         opacity=0.4,
                         marker=dict(color=color))]
    html = plotly.offline.plot(
        {"data": data,
         "layout": go.Layout(barmode='overlay',
                             title=title,
                             yaxis_title=ylabel,
                             xaxis_title=xlabel)},
        output_type="div",
        show_link=False)
    fig = go.Figure(
        {"data": data,
         "layout": go.Layout(barmode='overlay',
                             title=title)})
    return html, fig 
Example #2
Source File: dataset_stats.py    From dota2-predictor with MIT License 6 votes vote down vote up
def mmr_distribution(csv_file):
    dataset = pd.read_csv(csv_file)

    data = [go.Histogram(x=dataset[:30000]['avg_mmr'])]

    layout = go.Layout(
        title='MMR distribution (sample of 30k games)'
    )

    fig = go.Figure(data=data, layout=layout)

    py.iplot(fig, filename='MMR_distribution') 
Example #3
Source File: Data_Grabber.py    From Crypto_Trader with MIT License 6 votes vote down vote up
def update_market_prices_hist():
    global selected_dropdown_value
    global data
    prices = data.get_prices(selected_dropdown_value)
    prices = [list(p) for p in zip(*prices)]
    if len(prices) > 0:
        traces = []
        for i, key in enumerate(['bid', 'ask']):
            trace = go.Histogram(x=prices[i][-200:],
                                 name=key,
                                 opacity=0.8)
            traces.append(trace)
        return {
            'data': traces,
            'layout': dict(title="Market Prices Histogram (200 Most Recent)")
        } 
Example #4
Source File: Data_Grabber.py    From Crypto_Trader with MIT License 6 votes vote down vote up
def update_spread_hist():
    global selected_dropdown_value
    global data
    prices = data.get_prices(selected_dropdown_value)
    prices = [list(p) for p in zip(*prices)]
    if len(prices) > 0:
        traces = []
        trace = go.Histogram(x=list(prices[2][-200:]),
                             name='spread',
                             marker=dict(color='rgba(114, 186, 59, 0.5)'))
        traces.append(trace)

        return {
            'data': traces,
            'layout': dict(title="Spread Histogram (200 Most Recent)")
        } 
Example #5
Source File: components.py    From webmc3 with Apache License 2.0 6 votes vote down vote up
def hist_figure(trace_info, varname, ix_slice=None):
    return {
        'data': [
            go.Histogram(x=trace_info.get_values(varname, ix_slice=ix_slice))
        ],
        'layout': go.Layout(
            yaxis={'title': "Frequency"}
        )
    } 
Example #6
Source File: histogram.py    From DataPlotly with GNU General Public License v2.0 6 votes vote down vote up
def create_trace(settings):
        return [graph_objs.Histogram(
                x=settings.x,
                y=settings.x,
                name=settings.data_defined_legend_title if settings.data_defined_legend_title != '' else settings.properties['name'],
                orientation=settings.properties['box_orientation'],
                nbinsx=settings.properties['bins'],
                nbinsy=settings.properties['bins'],
                marker=dict(
                    color=settings.data_defined_colors if settings.data_defined_colors else settings.properties['in_color'],
                    line=dict(
                        color=settings.data_defined_stroke_colors if settings.data_defined_stroke_colors else settings.properties['out_color'],
                        width=settings.data_defined_stroke_widths if settings.data_defined_stroke_widths else settings.properties['marker_width']
                    )
                ),
                histnorm=settings.properties['normalization'],
                opacity=settings.properties['opacity'],
                cumulative=dict(
                    enabled=settings.properties['cumulative'],
                    direction=settings.properties['invert_hist']
                )
            )] 
Example #7
Source File: qc.py    From methplotlib with MIT License 6 votes vote down vote up
def modified_fraction_histogram(full):
    traces = [go.Histogram(x=full[dataset].dropna(),
                           histnorm='probability density',
                           xbins=dict(start=0, size=0.01, end=1),
                           name=dataset,
                           opacity=0.6
                           )
              for dataset in full.columns]
    layout = dict(barmode="overlay",
                  title="Histogram of modified fractions",
                  xaxis=dict(title="Modified fraction"),
                  yaxis=dict(title="Frequency"))
    return plotly.offline.plot(dict(data=traces,
                                    layout=layout),
                               output_type="div",
                               show_link=False,
                               include_plotlyjs='cdn') 
Example #8
Source File: dash-set-height-of-graph.py    From dash-recipes with MIT License 5 votes vote down vote up
def update_histogram(value):
    return {
        'data':[
           go.Histogram(
            x=df[value]
            )],
        'layout':go.Layout()
            } 
Example #9
Source File: histogram.py    From DataPlotly with GNU General Public License v2.0 5 votes vote down vote up
def name():
        return PlotType.tr('Histogram') 
Example #10
Source File: HydroSEDPlots.py    From WMF with GNU General Public License v3.0 4 votes vote down vote up
def Plot_Histogram(self, pathFigure):
        '''Hace un plot del histograma de la distribucion de la lluvia en la cuenca.'''
        #Hace una cipia de la informacion
        Data = self.rainData.copy()
        Data = Data[' Lluvia'].values
        Data = Data[Data>0]
        step = (np.percentile(Data,95) - np.percentile(Data,5))/7.
        #Genera los datos de la figura
        trace1 = go.Histogram(
            x = Data,
            name = 'Lluvia [mm]',
            xbins = dict(
                start = np.percentile(Data,5),
                end = np.percentile(Data,95),
                size = step)
        )
        #Establece la configuracion de la misma
        layout = dict(
            width=400,
            height=400,
            showlegend = False,
            margin=dict(
                l=50,
                r=50,
                b=70,
                t=50,
                pad=4
            ),
            yaxis=dict(
                title='PDF',
                titlefont=dict(
                    color='rgb(0, 102, 153)',
                    size = 15
                    ),
                tickangle=45,
                tickfont=dict(
                    color='rgb(0, 102, 153)',
                    size = 16,            
                    ),),
            xaxis = dict(
                title = 'Lluvia [mm]',
                titlefont =dict(
                    color='rgb(0, 102, 153)',
                    size = 15
                    ),
                tickfont=dict(
                    color='rgb(0, 102, 153)',
                    size = 16,            
                    )
                )
            )
        #Monta la figura 
        data = [trace1]
        fig = dict(data = data, layout = layout)
        plot(fig,filename=pathFigure, auto_open = False)