python: how to name the columns in the diagram



  • We need to weigh. result_1.values diagrams My code is:

    df_1['product_type'].value_counts()
    print(result_1.values)
    

    colors = ['red', 'violet', 'yellow', 'green']
    x_data = [i for i in range(len(result_1.values))]
    plt.bar(x_data, result_1.values,color=colors)
    plt.xticks(x_data,result_1.keys(),rotation=0)
    plt.ylabel("Количество")
    plt.show()`

    That's what happens:

    введите сюда описание изображения



  • Actually, I don't think you' matplotlib... But if my assumption is correct, try to add a parameter.

    tick_label: str, massive or optional o Cell for pole.

    challenge plt.bar(.) ♪ )♪ There's a great book: Abdrahmanov M.I. Python. Free! Issued devpractice.ru. It's very detailed on page 95.



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2