Now, we are going to look at the chart called side-by-side.png. This displays the differences in average test scores between students who went to two different middle schools before enrolling in your high school.


The data you will need to recreate this chart is in the lists middle_school_a, middle_school_b, and unit_topics.

Save your recreated chart to a file called my_side_by_side.png.



Using create_x, make the lists school_a_x and school_b_x which will determine where to put the bars for Middle School A and Middle School B along the x-axis.


Create a figure of width 10 and height 8.


Create a set of axes and save them to ax.


Plot a set of bars representing middle_school_a and a set representing middle_school_b next to each other on the same graph.


Create a new list of x-values called middle_x, which are the values in the middle of school_a_x and school_b_x. This is where we will place the x-ticks. Look at the final graph to see this placement.


Set the x-ticks to be the middle_x list.


Set the x-tick labels to be the list unit_topics.


Create a legend, as shown in the final graph, that labels the first set of bars Middle School A and the second set of bars Middle School B.


Create a title (“Test Averages on Different Units”), x-axis label (“Unit”), and y-axis label (“Test Average”).


Save your figure to a file called my_side_by_side.png.

Sign up to start coding

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?