0

My code is currently this- Using a date set I have created!

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

    desired_width=420
    pd.set_option('display.width', desired_width)
    np.set_printoptions(linewidth=desired_width)
    pd.set_option('display.max_columns',6)

    Data = pd.read_csv("/Volumes/DYLAN USB/Excel/DataSheets/Data Passing Feb EPL 202021.csv",index_col=0)

print(Data.head(20))

    fig, ax = plt.subplots()
    Data = Data.sort_values('Total Pass Completion %', ascending=False)
    ax.bar(Data.Team, Data['Total Pass Completion %'])
    ax.set_xticklabels (Data.Team, rotation=90, horizontalalignment = 'right', fontsize = '12')

   ax.set_title ('League Ranking and Points- EPL 2020/21 February', fontsize =22)
   ax.set_ylabel ('Pass Completition %')
   ax.set_xlabel ('Team Name')

1 Answers1

0

You need to provide some sample data if you want people to easily solve your question. I created some data below. You can index the bar objects matplotlib.patches.Rectangle and set them to the color you want

import pandas as pd 
import matplotlib.pyplot as plt 

Data = pd.DataFrame({'Total Pass Completion %': [100, 30, 8, 4], 'Team': ['A', 'B', 'C', 'D']})

fig, ax = plt.subplots()
Data = Data.sort_values('Total Pass Completion %', ascending=False)
ax.bar(Data.Team, Data['Total Pass Completion %'])
ax.set_xticklabels (Data.Team, rotation=90, horizontalalignment = 'right', fontsize = '12')

ax.set_title ('League Ranking and Points- EPL 2020/21 February', fontsize =22)
ax.set_ylabel ('Pass Completition %')
ax.set_xlabel ('Team Name')


ax.get_children()[1].set_color('r')
William Goodwin
  • 464
  • 2
  • 9