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


Python graph_objs.Margin方法代码示例

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


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

示例1: plot_bar

# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Margin [as 别名]
def plot_bar(data):
	app.layout = html.Div(children=[html.H1(children='CM PT'), html.Div(children='''History.'''),

	dcc.Graph(
		figure=go.Figure(
		data = data,
		layout=go.Layout(title='Streams', showlegend=False, barmode='stack', margin=go.Margin(l=200, r=0, t=40, b=20))),
	style={'height': 300},
	id='my-graph')
	]) 
开发者ID:plotly,项目名称:dash-recipes,代码行数:12,代码来源:dash-plot.py

示例2: open_figure

# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Margin [as 别名]
def open_figure(self, fig, props):
        """Creates a new figure by beginning to fill out layout dict.

        The 'autosize' key is set to false so that the figure will mirror
        sizes set by mpl. The 'hovermode' key controls what shows up when you
        mouse around a figure in plotly, it's set to show the 'closest' point.

        Positional agurments:
        fig -- a matplotlib.figure.Figure object.
        props.keys(): [
            'figwidth',
            'figheight',
            'dpi'
            ]

        """
        self.msg += "Opening figure\n"
        self.mpl_fig = fig
        self.plotly_fig['layout'] = go.Layout(
            width=int(props['figwidth'] * props['dpi']),
            height=int(props['figheight'] * props['dpi']),
            autosize=False,
            hovermode='closest')
        self.mpl_x_bounds, self.mpl_y_bounds = mpltools.get_axes_bounds(fig)
        margin = go.Margin(
            l=int(self.mpl_x_bounds[0] * self.plotly_fig['layout']['width']),
            r=int(
                (1-self.mpl_x_bounds[1]) * self.plotly_fig['layout']['width']),
            t=int((1-self.mpl_y_bounds[1]) * self.plotly_fig['layout'][
                'height']),
            b=int(self.mpl_y_bounds[0] * self.plotly_fig['layout']['height']),
            pad=0)
        self.plotly_fig['layout']['margin'] = margin 
开发者ID:jeanfeydy,项目名称:lddmm-ot,代码行数:35,代码来源:renderer.py

示例3: _update_graph

# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Margin [as 别名]
def _update_graph(map_style, region):
    dff = dataframe
    radius_multiplier = {'inner': 1.5, 'outer': 3}

    layout = go.Layout(
        title=metadata['title'],
        autosize=True,
        hovermode='closest',
        height=750,
        font=dict(family=theme['font-family']),
        margin=go.Margin(l=0, r=0, t=45, b=10),
        mapbox=dict(
            accesstoken=mapbox_access_token,
            bearing=0,
            center=dict(
                lat=regions[region]['lat'],
                lon=regions[region]['lon'],
            ),
            pitch=0,
            zoom=regions[region]['zoom'],
            style=map_style,
        ),
    )

    data = go.Data([
        # outer circles represent magnitude
        go.Scattermapbox(
            lat=dff['Latitude'],
            lon=dff['Longitude'],
            mode='markers',
            marker=go.Marker(
                size=dff['Magnitude'] * radius_multiplier['outer'],
                colorscale=colorscale_magnitude,
                color=dff['Magnitude'],
                opacity=1,
            ),
            text=dff['Text'],
            # hoverinfo='text',
            showlegend=False,
        ),
        # inner circles represent depth
        go.Scattermapbox(
            lat=dff['Latitude'],
            lon=dff['Longitude'],
            mode='markers',
            marker=go.Marker(
                size=dff['Magnitude'] * radius_multiplier['inner'],
                colorscale=colorscale_depth,
                color=dff['Depth'],
                opacity=1,
            ),
            # hovering behavior is already handled by outer circles
            hoverinfo='skip',
            showlegend=False
        ),
    ])

    figure = go.Figure(data=data, layout=layout)
    return figure 
开发者ID:jackdbd,项目名称:dash-earthquakes,代码行数:61,代码来源:app.py

示例4: _get_layout

# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Margin [as 别名]
def _get_layout(self, labels=[], zoom=1):
        
        steps = []
        for label in labels:
            step = dict(method = 'animate',
                        args = [[label]],
                        label = label
                        )
            steps.append(step)
            
        top_padding = 0 if (self.title is None) else self.height/8
        self.title_fontsize = self.height/20 if (self.title_fontsize=='auto') else self.title_fontsize
        
        layout={'height':self.height, 
                'width':self.width,
                'titlefont':{'color':self.title_fontcolor, 
                        'size':self.title_fontsize},
                #'paper_bgcolor':self.bg_color,
                'paper_bgcolor':'white',
                'plot_bgcolor':self.bg_color, 
                'xaxis': {'range': [-self.width*zoom/2, self.width*zoom/2], 
                          'autorange': False, 
                          'visible':self.axis_visible, 
                          'autotick':False, 
                          'dtick':10},
                'yaxis': {'range': [-self.height*zoom/2, self.height*zoom/2], 
                          'autorange': False, 
                          'visible':self.axis_visible, 
                          'autotick':False, 
                          'dtick':10},
                'margin':go.Margin(
                                l=0,
                                r=0,
                                b=0,
                                t=top_padding,
                                pad=0
                            ),
                'hovermode':'closest',
                'title': self.title,
                'sliders': [{'steps':steps}]
               }
        
        return layout 
开发者ID:mukund109,项目名称:word-mesh,代码行数:45,代码来源:utils.py


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