1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How to put x-axis values in order

Discussão em 'Python' iniciado por Stack, Novembro 29, 2025.

  1. Stack

    Stack Membro Participativo

    I have an Excel sheet with some players' heights/weights/ages etc. I'm trying to make a basic graph where I can show an average height/weight ratio and order x-axis from low to high? Sorry I'm just a beginner

    import pandas as pd
    import matplotlib.pyplot as plt
    import numpy as np

    var = pd.read_excel("C:\Program Files\currentnbaplayerslist.xlsx")
    print(var)

    x = list(var['Height'])
    y = list(var['Weight'])

    plt.figure(figsize=(10,10))
    plt.style.use('ggplot')
    plt.scatter(x,y,marker="o",s=100,edgecolors="white",c="green")
    plt.title("NBA players' height/weight")
    plt.xlabel("Height")
    plt.ylabel("Weight")

    plt.gcf().autofmt_xdate()
    plt.show()


    this is the result i get:
    [​IMG]

    Continue reading...

Compartilhe esta Página