<jupyter_start><jupyter_text>Bar Chart<jupyter_code>labels = ['A', 'B', 'C']
values = [3, 4, 2]
bar_plot = plt.bar(labels, values)
# bar_plot[0].set_hatch('/')
# bar_plot[1].set_hatch('o')
# bar_plot[2].set_hatch('*')
plt.figure(figsize=(8,5))

patterns = ['/', 'o', '*']

for i in range(len(patterns)):
    bar_plot[i].set_hatch(patterns[i])

plt.show()
data = pd.read_csv('gas_prices.csv')

plt.figure(figsize=(8,5), dpi = 360)

# plt.plot(data['Year'], data.USA, 'r.-', label = 'USA')

# plt.plot(data.Year, data.Germany,  'g.-', label = 'Germany')

for country in data:
    if country != 'Year':
        plt.plot(data['Year'], data[country], label=country, marker = '.')
    
plt.xlabel('Year', fontdict={'fontsize': 16})
plt.ylabel('Price', fontdict={'fontsize': 16})
plt.xticks(data.Year[::2])
plt.legend()

plt.title('Gas Price changes comparision between various countries',
          fontdict={'fontweight': 'bold', 'fontsize': 24})

# plt.savefig('gas_price_changes', dpi = 300)
plt.show()
fifa_data = pd.read_csv('fifa_data.csv')

fifa_data.head(3)<jupyter_output><empty_output><jupyter_text>Histogram<jupyter_code>bins = [i for i in range(0, 100, 10)]
plt.hist(fifa_data.Overall, bins = bins, color = '#0f0390')

plt.xlabel('Skill Level', fontdict = {'fontsize': 16})
plt.ylabel('Number of Players', fontdict = {'fontsize': 16})

plt.title('Distribution of Player skills in FIFA 2018', fontdict = {'fontweight': 'bold', 'fontsize': 20})

# plt.savefig('player_skills_distribution', dpi = 300)
plt.show()<jupyter_output><empty_output><jupyter_text>Pie Chart<jupyter_code>left = fifa_data.loc[fifa_data['Preferred Foot'] == 'Left'].count()[0]
right = fifa_data.loc[fifa_data['Preferred Foot'] == 'Right'].count()[0]

labels = ['Left', 'Right']

colors = ['#f00', '#0f0']

plt.figure(figsize = (4, 5), dpi = 180)

plt.pie([left, right], labels = labels, colors = colors, autopct = '%.2f %%')

plt.title('Foot preference of FIFA players')
# plt.savefig('players_foot_preference', dpi = 300)
plt.show()
avg_weight = pd.Series([float(str(x).strip('lbs')) if type(x) == str else 0 for x in fifa_data.Weight]).mean()

DecimalWeights = [float(str(x).strip('lbs')) if type(x) == str else avg_weight for x in fifa_data.Weight]

fifa_data['DecimalWeights'] = pd.Series(DecimalWeights)
light = fifa_data.loc[fifa_data['DecimalWeights'] < 125].count()[0]
light_medium = fifa_data.loc[(fifa_data['DecimalWeights'] >= 125) & (fifa_data['DecimalWeights'] < 150)].count()[0]
medium = fifa_data.loc[(fifa_data['DecimalWeights'] >= 150) & (fifa_data['DecimalWeights'] < 175)].count()[0]
medium_heavy = fifa_data.loc[(fifa_data['DecimalWeights'] >= 175) & (fifa_data['DecimalWeights'] < 200)].count()[0]
heavy = fifa_data.loc[fifa_data['DecimalWeights'] >= 200].count()[0]

weights = list(map(lambda x: float(x), [light, light_medium, medium, medium_heavy, heavy]))
labels = ['Under 125', '125 - 150', '150 - 175' ,'175 - 200', 'Over 200']

plt.style.use('ggplot')
plt.figure(figsize = (6, 4), dpi = 150)

explode = (0.4, 0.2, 0, 0, 0.4)
plt.pie(weights, labels = labels, explode = explode, autopct = '%.2f %%', pctdistance = 0.9) 

plt.title('Weight Distribution of FIFA players (lbs)')
# plt.savefig('players_weight_distribution', dpi = 300)
plt.show()<jupyter_output><empty_output><jupyter_text>Box plot<jupyter_code>barcelona = fifa_data.loc[fifa_data.Club == 'FC Barcelona']['Overall']
madrid = fifa_data.loc[fifa_data.Club == 'Real Madrid']['Overall']
new_england = fifa_data.loc[fifa_data.Club == 'New England Revolution']['Overall']

plt.style.use('default')
plt.figure(figsize=(9,6), dpi = 180)

labels = ['FC Barcelona', 'Real Madrid', 'New England Revolution']
boxes = plt.boxplot([barcelona, madrid, new_england], labels = labels, 
                    patch_artist = True, medianprops = {'linewidth': 1.8})

for box in boxes['boxes']:
    box.set(color = '#20f0ff', linewidth = 1.5)
    box.set(facecolor = '#ddd')

plt.title('Professional Soccer Teams comparision', fontdict = {'fontsize': 20})
plt.ylabel('FIFA Overall Rating', fontdict = {'fontsize': 16})
# plt.savefig('soccer_teams_comp', dpi = 300)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.19768563162970107, 'fraction_numerical': 0.037367405978784955, 'mean_word_length': 5.926544240400668, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '216395', 'license': 'MIT', 'n_tokens_mistral': 1724, 'n_tokens_neox': 1558, 'n_words': 310, 'path': 'src/Matplotlib.ipynb', 'repo_name': 'pashamakhilkumarreddy/matplotlib-snippets', 'size': '4148'}