本文整理汇总了Python中plotly.graph_objs.Contour方法的典型用法代码示例。如果您正苦于以下问题:Python graph_objs.Contour方法的具体用法?Python graph_objs.Contour怎么用?Python graph_objs.Contour使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plotly.graph_objs
的用法示例。
在下文中一共展示了graph_objs.Contour方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __2D_density_plot
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Contour [as 别名]
def __2D_density_plot (self,
x_field_name, y_field_name, x_lab, y_lab, x_scale, y_scale, x_nbins, y_nbins,
colorscale, smooth_sigma, width, height, plot_title):
"""Private function generating density plots for all 2D distribution functions"""
self.logger.info ("\t\tComputing plot")
# Prepare all data
lab1, dd1 = self.__2D_density_data ("all", x_field_name, y_field_name, x_nbins, y_nbins, x_scale, y_scale, smooth_sigma)
lab2, dd2 = self.__2D_density_data ("pass", x_field_name, y_field_name, x_nbins, y_nbins, x_scale, y_scale, smooth_sigma)
# Plot initial data
data = [
go.Contour (x=dd1["x"][0], y=dd1["y"][0], z=dd1["z"][0], contours=dd1["contours"][0],
name="Density", hoverinfo="name+x+y", colorscale=colorscale, showlegend=True, connectgaps=True, line={"width":0}),
go.Scatter (x=dd1["x"][1], y=dd1["y"][1],
mode='markers', name='Median', hoverinfo="name+x+y", marker={"size":12,"color":'black', "symbol":"x"})]
# Create update buttons
updatemenus = [
dict (type="buttons", active=0, x=-0.2, y=0, xanchor='left', yanchor='bottom', buttons = [
dict (label=lab1, method='restyle', args=[dd1]),
dict (label=lab2, method='restyle', args=[dd2])])]
# tweak plot layout
layout = go.Layout (
hovermode = "closest",
plot_bgcolor="whitesmoke",
legend = {"x":-0.2, "y":1,"xanchor":'left',"yanchor":'top'},
updatemenus = updatemenus,
width = width,
height = height,
title = {"text":plot_title, "xref":"paper" ,"x":0.5, "xanchor":"center"},
xaxis = {"title":x_lab, "showgrid":True, "zeroline":False, "showline":True, "type":x_scale},
yaxis = {"title":y_lab, "showgrid":True, "zeroline":False, "showline":True, "type":y_scale})
return go.Figure (data=data, layout=layout)
示例2: func
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Contour [as 别名]
def func(custom_data_storage):
data = json.loads(custom_data_storage)
trace0 = go.Contour(
x=np.linspace(0, 10, 200),
y=np.linspace(0, 10, 200),
z=np.ones(shape=(200, 200)),
showscale=False,
hoverinfo='none',
contours=dict(coloring='lines'),
)
trace1 = go.Scatter(
x=data['train_X'],
y=data['train_y'],
mode='markers',
name='Training'
)
trace2 = go.Scatter(
x=data['test_X'],
y=data['test_y'],
mode='markers',
name='Training'
)
data = [trace0, trace1, trace2]
figure = go.Figure(data=data)
return figure
示例3: name
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Contour [as 别名]
def name():
return PlotType.tr('Contour Plot')
示例4: create_trace
# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Contour [as 别名]
def create_trace(settings):
return [graph_objs.Contour(
z=[settings.x, settings.y],
contours=dict(
coloring=settings.properties['cont_type'],
showlines=settings.properties['show_lines']
),
colorscale=settings.properties['color_scale'],
opacity=settings.properties['opacity']
)]