Question: please see questions in the documents 1.5 Problem 1.5 (5 points) For the next problem, we would like to draw a dumbbell plot (sometimes called
please see questions in the documents
1.5




Problem 1.5 (5 points) For the next problem, we would like to draw a "dumbbell plot" (sometimes called a ranged dot plot). Our version will allow us to compare the difference between certain actor categories by gender (with a hint as to whether the movie passed the Bechdel Test in the color of the range line). It will look something like this when we're done: Moana- The Jungle Book Captain America: Civil War Star Trek Beyond The Secret Life of Pets- Jason Bourne Rogue One Doctor Strange Finding Dory Suicide Squad Kung Fu Panda 3- Zootopia Deadpool Trolls Sing Fantastic Beasts and Where to Find T... X-Men: Apocalypse La La Land Hidden Figures Batman v Superman: Dawn of Justice 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 typeCount passed Bechdel, gender Female Male failed passed Creating this requires layering a range line (specified using the 'Line' mark) and the dots (using 'Circle'). As you can see below, our first attempt failed because the mark_line tries to connect all the points. Modify one line to generate the example above. Hint: find the documentation for the mark type on the vega-lite site. [] # modify the following function by adding one line of code def problem15 (indf, movieOrder, typeString): IIIIII input: base -- 'base' chart as defined above HAH-H # grab a subset of the data for M/F and for the type described in the type string subset indf [(indf. roleType== typeString) & (indf.gender = "Unknown")] # create the dot plot typeDots alt. Chart (subset).mark_circle(size=200, opacity=1).encode( ) color='gender', y=alt. Y('movieName: N', sort='x'), x=alt.x('typeCount: Q') # Add *one line* so that the rangeLine will draw a line between the male and female dots rangeLine typeDots.mark_line(strokeWidth=5).encode( color='passedBechdel:N' ) # YOUR CODE HERE raise NotImplementedError()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
