<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Welcome to the Python Plotting Tutorial for Com520!
This is intended as a self-guided exercise to help you explore python plotting. Please follow the document, follow the links and read the documentation. I'll be circulating to help you if you have questions.
Step1:  A super simple chart
The simplest possible plot is a line chart. See the example below. Answer the following questions
Step2:  Try This
Using the documentation for matplotlib.pyplot found here make a plot for the following data set. In this case, you want to plot both x and y values.
Step3:  Improving the plot
When I made the plot above, it was a very jumbled line chart, which didn't look very good. Using the tutorial figure out how to plot the points as dots rather than as a line chart.
Step4:  If you look carefully at the data, you'll find cases where the same exact point shows up twice or more. One trick is to use alpha or the transparency of a dot to handle overlapping data. Using the argument alpha=0.3 in the plot above to make each particular dot slightly transparent.
Step5:  Challenge
Last week, we processed the congressional district data to produce a data set with the percent of the working population in each industry compared to the mean and median salary in that district. You opened that data in Excel to produce a plot.
Recreate a plot of percent of the district in engineering and the mean salary for that district. Make sure to label your axes.
(Hint) remember
Step6:  Bar charts
The line charts above are great for cardinal data, but python can do many other kinds of plots. Here, we'll make a bar chart. There are a few differences
Step7:  Try it
Add another bar to the same chart for the monthly low temperature. Make sure you label your axes!
Styles
Now that we've created some simple charts in python, let's see how to make them beautiful!
Matplotlib comes with many pre-built style packages that can be used to make your plots automatically look professional. Try the samples below for a taste. 
The full set can be found by running the command below
Step8:  Use a style like this
Step9:  Try it!
Set a context like above and rerun any of the plots in your document.
Histograms
Pyplot includes excellent support for histograms. A histogram uses the range of your data on the x-axis. It divides that range in to buckets (usually with equal widths) and counts the number of values that fall into each bucket. Look at the example below
Step10:  Do it!
Read in the mean salary per congressional district and construct a histogram from that data.
* Investigate the bins argument. What happens if you set this too high? What if you set it too low? Generally, sqrt(n) is a good size for n data points.
Challenge
Get the salary data from here (it's the tsv file).  Import this file into python and build a histogram of salary.
How many bins are a good fit?
There are clearly outliers in this data. Investigate the range argument to hist to help truncate the plot.
What does the normalize argument do?
Hint
<ASSISTANT_TASK:>
Python Code:
# This section imports some important libraries that we'll need.
# the most important is the second line. After you run this, "plt" will be
# the plotting library in python.
import numpy
import matplotlib.pyplot as plt
Explanation: Welcome to the Python Plotting Tutorial for Com520!
This is intended as a self-guided exercise to help you explore python plotting. Please follow the document, follow the links and read the documentation. I'll be circulating to help you if you have questions.
End of explanation
my_data = [1,2.4,-1.3,4]
plt.plot(my_data)
plt.ylabel("yi")
plt.xlabel("hi")
plt.title("A plot!")
plt.show()
Explanation: A super simple chart
The simplest possible plot is a line chart. See the example below. Answer the following questions:
* What variable holds the data?
* We only defined one data series. Is it on the y or x axis?
* What do the functions ylabel, xlabel, and title do? Remove them to test your idea.
End of explanation
height = [68, 66, 75, 71, 67, 65, 67, 75, 72, 74, 72, 75, 69, 70, 65, 64, 68, 73, 70, 76, 64, 64, 66, 63, 68, 62, 72, 74, 76, 69, 65, 65, 64, 66, 64, 72, 74]
shoe_size = [12 ,9 ,12 ,11 ,12 ,8.5 ,9 ,13 ,11 ,12 ,12 ,12 ,10 ,11 ,10 ,8 ,9 ,11 ,8 ,12 ,8 ,9 ,11 ,10 ,9 ,9 ,11 ,11 ,12 ,10 ,8 ,7 ,9 ,10 ,13 ,12 ,11]
# put your code here
Explanation: Try This
Using the documentation for matplotlib.pyplot found here make a plot for the following data set. In this case, you want to plot both x and y values.
End of explanation
# put your new plot here
Explanation: Improving the plot
When I made the plot above, it was a very jumbled line chart, which didn't look very good. Using the tutorial figure out how to plot the points as dots rather than as a line chart.
End of explanation
# put your code here. Make sure you include axis labels and a title!
Explanation: If you look carefully at the data, you'll find cases where the same exact point shows up twice or more. One trick is to use alpha or the transparency of a dot to handle overlapping data. Using the argument alpha=0.3 in the plot above to make each particular dot slightly transparent.
End of explanation
# put your code here.
Explanation: Challenge
Last week, we processed the congressional district data to produce a data set with the percent of the working population in each industry compared to the mean and median salary in that district. You opened that data in Excel to produce a plot.
Recreate a plot of percent of the district in engineering and the mean salary for that district. Make sure to label your axes.
(Hint) remember: all of the python you have learned will work in the notebook. You can still use open for instance.
End of explanation
month = ["jan", "feb", "mar", 'apr', 'may', 'june', 'july', 'aug', 'sept', 'oct', 'nov', 'dec']
high = [45, 48, 52, 58, 64, 69, 72, 73, 67, 59, 51, 47]
low = [36, 37, 39, 43, 47, 52, 54, 55, 52, 47, 41, 38]
fake_x_data = range(len(month))
width = .8
plt.bar(fake_x_data, high, width)
plt.xticks(fake_x_data, month)
plt.show()
Explanation: Bar charts
The line charts above are great for cardinal data, but python can do many other kinds of plots. Here, we'll make a bar chart. There are a few differences:
First of all, we still need an x and a y variable. I made a fake set of data for the x axis using range and len. What are the values in fake_x_data?
Play with the width variable to see what it does to the plot.
Note that we use xticks to label our groupings.
End of explanation
list(plt.style.available)
Explanation: Try it
Add another bar to the same chart for the monthly low temperature. Make sure you label your axes!
Styles
Now that we've created some simple charts in python, let's see how to make them beautiful!
Matplotlib comes with many pre-built style packages that can be used to make your plots automatically look professional. Try the samples below for a taste. 
The full set can be found by running the command below:
End of explanation
plt.style.use("ggplot")
Explanation: Use a style like this:
End of explanation
fake_data = [1, 1, 1, 1, 2, 2, 3, 4, 5, 1, 2, 3, 4, 6, 7]
plt.hist(fake_data)
plt.show()
Explanation: Try it!
Set a context like above and rerun any of the plots in your document.
Histograms
Pyplot includes excellent support for histograms. A histogram uses the range of your data on the x-axis. It divides that range in to buckets (usually with equal widths) and counts the number of values that fall into each bucket. Look at the example below:
End of explanation
# put your code here.
Explanation: Do it!
Read in the mean salary per congressional district and construct a histogram from that data.
* Investigate the bins argument. What happens if you set this too high? What if you set it too low? Generally, sqrt(n) is a good size for n data points.
Challenge
Get the salary data from here (it's the tsv file).  Import this file into python and build a histogram of salary.
How many bins are a good fit?
There are clearly outliers in this data. Investigate the range argument to hist to help truncate the plot.
What does the normalize argument do?
Hint: here is the documentation
End of explanation
<END_TASK>