本文整理汇总了Python中plotly.graph_objs.Histogram方法的典型用法代码示例。如果您正苦于以下问题:Python graph_objs.Histogram方法的具体用法?Python graph_objs.Histogram怎么用?Python graph_objs.Histogram使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plotly.graph_objs
的用法示例。
在下文中一共展示了graph_objs.Histogram方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: plotly_histogram
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Histogram [as 别名]
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
示例2: mmr_distribution
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Histogram [as 别名]
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')
示例3: update_market_prices_hist
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Histogram [as 别名]
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)")
}
示例4: update_spread_hist
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Histogram [as 别名]
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)")
}
示例5: create_trace
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Histogram [as 别名]
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']
)
)]
示例6: modified_fraction_histogram
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Histogram [as 别名]
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')
示例7: update_histogram
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Histogram [as 别名]
def update_histogram(value):
return {
'data':[
go.Histogram(
x=df[value]
)],
'layout':go.Layout()
}
示例8: hist_figure
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Histogram [as 别名]
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"}
)
}
示例9: name
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Histogram [as 别名]
def name():
return PlotType.tr('Histogram')
示例10: Plot_Histogram
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Histogram [as 别名]
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)