<jupyter_start><jupyter_text>Matplotlib Challenge Problem<jupyter_code>import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline<jupyter_output><empty_output><jupyter_text>1. Create a pie chart like the one below of the number of bachelor's degrees awarded in different fields in 2014<jupyter_code>majors = [ "Agricultural Sciences", "Biological sciences", "Computer sciences", 
          "Earth sciences","Mathematics and statistics", 
          "Physical sciences", "Psychology", "Social sciences","Engineering"]
number_of_degrees = [28796,109520,56130,22226,6730,22222,118405,177936,93950]
plot = plt.pie(number_of_degrees,labels=majors)
plt.title("Bachelors Degrees awarded in 2014")<jupyter_output><empty_output><jupyter_text>2. Make a bar chart of the number of women and men who got bachelor's degrees in each of these fields in 2014. Hint 1: Use `?plt.bar` if you are stuck. Hint 2: If you're still stuck, try Googling what you're trying to figure out.Hint 3: This might help you out: https://matplotlib.org/examples/pylab_examples/barchart_demo.html<jupyter_code>male = [13271,44811,45986,4134,12715,13407,27554,80813,75324]
female = [15525,64709,10144,2596,9511,8815,90851,97123,18626]
fig, ax = plt.subplots()
plt.bar(np.arange(len(male))-0.2,male,width=0.2,color='b',align='center',label='male')
plt.bar(np.arange(len(female)),female,width=0.2,color='g',align='center',label='female')
plt.title("Number of Women and Men awarded Bachelor's degrees (2014)")
plt.ylabel("Number")
ax.set_xticks(np.arange(len(female))-0.5)
ax.set_xticklabels(majors,rotation=70)
plt.show()<jupyter_output><empty_output><jupyter_text>3. If you still have time, try to replicate this: https://matplotlib.org/examples/shapes_and_collections/path_patch_demo.html. Once you've done that, try making your own shape!<jupyter_code>?plt.bar<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1276824034334764, 'fraction_numerical': 0.08851931330472103, 'mean_word_length': 7.5159817351598175, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 2, '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': '423869', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 784, 'n_tokens_neox': 654, 'n_words': 147, 'path': 'solutions/4_Matplotlib_1_Solution.ipynb', 'repo_name': 'DCMB-GWC/challengeQuestions', 'size': '1864'}