1

Here's the table from the dataframe:

Points_groups Qty Contracts Qty Gones
1 350+ 108 275
2 300-350 725 1718
3 250-300 885 3170
4 200-250 2121 10890
5 150-200 3120 7925
6 100-150 653 1318
7 50-100 101 247
8 0-50 45 137

I'd like to get something like this out of it:

Enter image description here

But that the columns correspond to the 'x' axis, which was built from the 'Scores_groups' column like this

Enter image description here

I tried a bunch of options already, but I couldn't get it.

For example:

df.plot(kind ='hist')
plt.xlabel('Points_groups')
plt.ylabel("Number Of Students");

or

sns.distplot(df['Кол-во Ушедшие'])
sns.distplot(df['Кол-во Контракт'])
plt.show()

or

df.hist(column='Баллы_groups', by= ['Кол-во Контракт', 'Кол-во Ушедшие'], bins=2, grid=False, rwidth=0.9,color='purple', sharex=True);
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Viktor_M
  • 11
  • 1
  • Does this comment stackoverflow question help? https://stackoverflow.com/questions/31632637/label-axes-on-seaborn-barplot – Manumerous Nov 13 '22 at 17:21

1 Answers1

0

Since you already have the distribution in your pandas dataframe, the plot you need can be achieved with the following code:

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

Df = pd.DataFrame({'key': ['red', 'green', 'blue'], 'A': [1, 2, 1], 'B': [2, 4, 3]})

X_axis = np.arange(len(Df['key']))

plt.bar(X_axis - 0.2, Df['A'], 0.4, label = 'A')
plt.bar(X_axis + 0.2, Df['B'], 0.4, label = 'B')

X_label = list(Df['key'].values)
plt.xticks(X_axis, X_label)
plt.legend()
plt.show()

Since I don't have access to your data, I made some mock dataframe. This results in the following figure:

Enter image description here

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Manumerous
  • 455
  • 6
  • 21