Skip to content

What's the difference between sortvalued gapminder and original gapminder while ploting a line plot? #5280

@kenkang99

Description

@kenkang99
import plotly.express as px 

gapminder = px.data.gapminder()

gapAsia = gapminder[gapminder['continent']=='Asia']
px.line(gapAsia,x='year',y='lifeExp')
Image
gapAsia = gapminder[gapminder['continent']=='Asia']
gapAsia_sort = gapAsia.sort_values(by='year')
px.line(gapAsia_sort,x='year',y='lifeExp')
Image

gapAsia might be the correct line plot i guess.

But I wonder why the line plot from gapAsia_sort look like above this.

Can anyone figure out it and explain this issue to me?

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