Skip to content

set the yaxis parameters(tickformat='p') #1537

Closed
@fenghuoqiuqiu

Description

@fenghuoqiuqiu

I want to use percentage format(retain four decimal) ,When I set the yaxis parameters(tickformat='p'), but there are always some display problems.

This is my code:

import plotly.offline as py
from plotly.graph_objs import Scatter, Layout
import plotly.graph_objs as go
py.init_notebook_mode(connected=True)

trace1=go.Scatter(
    name="lenged2",
    x=['2018-01','2018-02','2018-03','2018-04','2018-05','2018-06','2018-07','2018-08','2018-09'],
    y=[0.1,0.3,0.5,0.4,0.7,0.3,0.4,0.2,0.4,0.5], 
)

layout=go.Layout(
    showlegend=True, 
    legend=dict(x=1.05,y=1.1),
    xaxis=dict(showticklabels=True),
    yaxis=dict(
                tickformat='p',
                showgrid=False,

))
data=[trace1]
fig=go.Figure(data=data, layout=layout)
py.iplot(fig)

image

Any help is greatly appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions