Python plotly.graph_objs 模块,YAxis() 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用plotly.graph_objs.YAxis()

项目:memote    作者:opencobra    | 项目源码 | 文件源码
def scatter_line_chart(df, y_title):
    """Generate a reproducible plotly scatter and line plot."""
    if len(df.columns) == 3:
        x_axis, y_axis, factor = df.columns
        data = go.Data([
            go.Scatter(x=sub[x_axis], y=sub[y_axis], name=key)
            for key, sub in df.groupby(factor, as_index=False, sort=False)])
    else:
        x_axis, y_axis = df.columns
        data = go.Data([
            go.Scatter(x=df[x_axis], y=df[y_axis])])
    layout = go.Layout(
        width=650,
        height=500,
        xaxis=go.XAxis(
            title="Commit Hash" if x_axis == "commit_hash" else "Timestamp",
            tickangle=-45 if x_axis == "commit_hash" else 0
        ),
        yaxis=go.YAxis(
            title=y_title
        )
    )
    return Markup(py.plot(go.Figure(data=data, layout=layout), **_DEFAULT_ARGS))
项目:lddmm-ot    作者:jeanfeydy    | 项目源码 | 文件源码
def setup_layout(self) :
        "Setup the axis properties."
        axis = dict(
                showbackground=True,
                backgroundcolor='rgb(230, 230, 230)',
                gridcolor='rgb(255, 255, 255)',
                zerolinecolor='rgb(255, 255, 255)'
            )
        xaxis = axis.copy()
        xaxis['range'] = [-1.1,1.1]
        yaxis = axis.copy()
        yaxis['range'] = [-1.1,1.1]
        zaxis = axis.copy()
        zaxis['range'] = [-1.1,1.1]
        aspectratio=dict(x=1, y=1, z=1)
        self.layout = go.Layout(
            title='Kendall Triangles',
            width='100%',
            height= 800,
            scene=go.Scene(
                xaxis=go.XAxis(xaxis),
                yaxis=go.YAxis(yaxis),
                zaxis=go.ZAxis(zaxis),
                aspectratio=dict(
                    x=aspectratio['x'],
                    y=aspectratio['y'],
                    z=aspectratio['z']),
                )
            )
项目:memote    作者:opencobra    | 项目源码 | 文件源码
def boolean_chart(df, y_title):
    """Generate a reproducible plotly scatter and line plot."""
    if len(df.columns) == 3:
        x_axis, y_axis, factor = df.columns
        data = go.Data([
            go.Scatter(x=sub[x_axis], y=sub[y_axis].astype(int), name=key)
            for key, sub in df.groupby(factor, as_index=False, sort=False)])
    else:
        x_axis, y_axis = df.columns
        data = go.Data([
            go.Scatter(x=df[x_axis], y=df[y_axis].astype(int))])
    layout = go.Layout(
        width=650,
        height=500,
        xaxis=go.XAxis(
            title="Commit Hash" if x_axis == "commit_hash" else "Timestamp",
            tickangle=-45 if x_axis == "commit_hash" else 0
        ),
        yaxis=go.YAxis(
            title=y_title,
            zeroline=False,
            tickmode="array",
            tickvals=[0, 1],
            ticktext=["No", "Yes"]
        )
    )
    return Markup(py.plot(go.Figure(data=data, layout=layout), **_DEFAULT_ARGS))
项目:lddmm-ot    作者:jeanfeydy    | 项目源码 | 文件源码
def show(self, title):
        figs = []
        for ind_f in range(len(self.frames)) :
            (points, triangles, signals) = self.frames[ind_f]
            points = array(points)
            triangles = array(triangles)
            signals = array(signals)
            signals_per_triangle = list( (signals[triangles[i,0]] + signals[triangles[i,1]] + signals[triangles[i,2]]) / 3
                                        for i in range(triangles.shape[0]) )
            signals_per_triangle[0] += 0.001
            # Validate colormap
            my_colormap = FF._validate_colors("Portland", 'tuple')
            newdata = FF._trisurf(x=points[:,2], y=points[:,0], z=points[:,1],
                                 colormap=my_colormap,
                                 simplices=triangles,
                                 color_func = signals_per_triangle,
                                 plot_edges=False,
                                 edges_color = 'rgb(50, 50, 50)',
                                 show_colorbar = False,
                                 data_list = True)
            figs +=  newdata
        axis = dict(
            showbackground=True,
            backgroundcolor='rgb(230, 230, 230)',
            gridcolor='rgb(255, 255, 255)',
            zerolinecolor='rgb(255, 255, 255)'
        )
        xaxis = axis.copy()
        xaxis['range'] = [-0.08,0.09]
        yaxis = axis.copy()
        yaxis['range'] = [-0.11,0.05]
        zaxis = axis.copy()
        zaxis['range'] = [0.02,0.18]
        aspectratio=dict(x=1, y=1, z=1)
        layout = graph_objs.Layout(
            title=title,
            width='100%',
            height= 800,
            scene=graph_objs.Scene(
                xaxis=graph_objs.XAxis(xaxis),
                yaxis=graph_objs.YAxis(yaxis),
                zaxis=graph_objs.ZAxis(zaxis),
                aspectratio=dict(
                    x=aspectratio['x'],
                    y=aspectratio['y'],
                    z=aspectratio['z']),
                )
        )

        return my_iplot(graph_objs.Figure( data = figs, layout=layout))