Skip to content

SI prefixes don't display Peta (P) correctly #4787

Open
plotly/plotly.js
#7249
@joshlk

Description

@joshlk

Take this example whereby I set the exponentformat="SI" to use SI prefixes for the y-axis:

import plotly.express as px
import pandas as pd
import numpy as np

df = pd.DataFrame({'x': np.arange(1, 5), 'y': np.arange(1, 5)*1e12})
fig = px.line(
    df,
    x="x",
    y="y",
)
fig.update_layout(
    yaxis=dict(showexponent="all", exponentformat="SI"),
)

This correctly displays the y-axis using Tera (T) SI prefix units

newplot(1)

If you increase the numbers so they are in the Peta (P) range:

df = pd.DataFrame({'x': np.arange(1, 5), 'y': np.arange(1, 5)*1e15})
fig = px.line(
    df,
    x="x",
    y="y",
)
fig.update_layout(
    yaxis=dict(showexponent="all", exponentformat="SI"),
)

It stops using SI prefixes on the y-axis and displays the numbers using x10^15:

newplot(2)

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions