当前位置: 首页>>代码示例>>Python>>正文


Python express.scatter方法代码示例

本文整理汇总了Python中plotly.express.scatter方法的典型用法代码示例。如果您正苦于以下问题:Python express.scatter方法的具体用法?Python express.scatter怎么用?Python express.scatter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在plotly.express的用法示例。


在下文中一共展示了express.scatter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: update_graph

# 需要导入模块: from plotly import express [as 别名]
# 或者: from plotly.express import scatter [as 别名]
def update_graph(xaxis_column_name, yaxis_column_name,
                 xaxis_type, yaxis_type,
                 year_value):
    dff = df[df['Year'] == year_value]
            
    fig = px.scatter(x=dff[dff['Indicator Name'] == xaxis_column_name]['Value'],
                     y=dff[dff['Indicator Name'] == yaxis_column_name]['Value'],
                     hover_name=dff[dff['Indicator Name'] == yaxis_column_name]['Country Name'])
        
    fig.update_layout(margin={'l': 40, 'b': 40, 't': 10, 'r': 0}, hovermode='closest')
    
    fig.update_xaxes(title=xaxis_column_name, 
                     type='linear' if xaxis_type == 'Linear' else 'log') 
    
    fig.update_yaxes(title=yaxis_column_name, 
                     type='linear' if yaxis_type == 'Linear' else 'log') 

    return fig 
开发者ID:plotly,项目名称:dash-docs,代码行数:20,代码来源:getting_started_multiple_viz.py

示例2: update_graph

# 需要导入模块: from plotly import express [as 别名]
# 或者: from plotly.express import scatter [as 别名]
def update_graph(xaxis_column_name, yaxis_column_name,
                 xaxis_type, yaxis_type,
                 year_value):
    dff = df[df['Year'] == year_value]

    fig = px.scatter(x=dff[dff['Indicator Name'] == xaxis_column_name]['Value'],
            y=dff[dff['Indicator Name'] == yaxis_column_name]['Value'],
            hover_name=dff[dff['Indicator Name'] == yaxis_column_name]['Country Name']
            )

    fig.update_traces(customdata=dff[dff['Indicator Name'] == yaxis_column_name]['Country Name'])

    fig.update_xaxes(title=xaxis_column_name, type='linear' if xaxis_type == 'Linear' else 'log')

    fig.update_yaxes(title=yaxis_column_name, type='linear' if yaxis_type == 'Linear' else 'log')

    fig.update_layout(margin={'l': 40, 'b': 40, 't': 10, 'r': 0}, hovermode='closest')

    return fig 
开发者ID:plotly,项目名称:dash-docs,代码行数:21,代码来源:getting_started_crossfilter.py

示例3: create_time_series

# 需要导入模块: from plotly import express [as 别名]
# 或者: from plotly.express import scatter [as 别名]
def create_time_series(dff, axis_type, title):

    fig = px.scatter(dff, x='Year', y='Value')

    fig.update_traces(mode='lines+markers')

    fig.update_xaxes(showgrid=False)

    fig.update_yaxes(type='linear' if axis_type == 'Linear' else 'log')

    fig.add_annotation(x=0, y=0.85, xanchor='left', yanchor='bottom',
                       xref='paper', yref='paper', showarrow=False, align='left',
                       bgcolor='rgba(255, 255, 255, 0.5)', text=title)

    fig.update_layout(height=225, margin={'l': 20, 'b': 30, 'r': 10, 't': 10})

    return fig 
开发者ID:plotly,项目名称:dash-docs,代码行数:19,代码来源:getting_started_crossfilter.py

示例4: build_scatter_trendline

# 需要导入模块: from plotly import express [as 别名]
# 或者: from plotly.express import scatter [as 别名]
def build_scatter_trendline(x, y, trendline):
    fig = px.scatter(x=x, y=y, trendline=trendline)
    return fig.data[1] 
开发者ID:man-group,项目名称:dtale,代码行数:5,代码来源:charts.py

示例5: update_figure

# 需要导入模块: from plotly import express [as 别名]
# 或者: from plotly.express import scatter [as 别名]
def update_figure(selected_year):
    filtered_df = df[df.year == selected_year]
    
    fig = px.scatter(filtered_df, x="gdpPercap", y="lifeExp", 
                     size="pop", color="continent", hover_name="country", 
                     log_x=True, size_max=55)
    
    fig.update_layout(transition_duration=500)

    return fig 
开发者ID:plotly,项目名称:dash-docs,代码行数:12,代码来源:getting_started_graph.py

示例6: update_store_data

# 需要导入模块: from plotly import express [as 别名]
# 或者: from plotly.express import scatter [as 别名]
def update_store_data(indicator, country):
    dff = df[df['country'] == country]
    return px.scatter(dff, x='year', y=str(indicator)) 
开发者ID:plotly,项目名称:dash-docs,代码行数:5,代码来源:graph_update_fe_be_px.py

示例7: scatter

# 需要导入模块: from plotly import express [as 别名]
# 或者: from plotly.express import scatter [as 别名]
def scatter(self, x: str = None, y: str = None, color: str = None, **kwargs):
        import plotly.express as px

        if len(self.metric_names) < 2:
            raise ValueError("You need at least 2 metrics to use this plot.")

        df = self.get_wide_df()
        return px.scatter(df, x=x, y=y, color=color, **kwargs) 
开发者ID:polyaxon,项目名称:polyaxon,代码行数:10,代码来源:run_plot.py


注:本文中的plotly.express.scatter方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。