A comma-separated value (CSV) file has four fields labeled name, birth year, gender, and graduation year. What line of code would be appropriate to visualize counts of gender by birthYear with each gender having its own color?(1 point)

Responses

catplot(x = 'birthYear',col = "gender", data = data, hue = 'gender', kind = "count")
catplot(x = 'birthYear',col = "gender", data = data, hue = 'gender', kind = "count")

catplot(x = 'birthYear',col = "gender", data = data, hue = 'birthYear', kind = "count")
catplot(x = 'birthYear',col = "gender", data = data, hue = 'birthYear', kind = "count")

catplot(x = 'gender',col = "birthYear", data = data, hue = 'gender', kind = "count")
catplot(x = 'gender',col = "birthYear", data = data, hue = 'gender', kind = "count")

catplot(x = 'gender',col = "birthYear", data = data, hue = 'birthYear', kind = "count")

1 answer

To visualize counts of gender by birth year with each gender having its own color, the appropriate line of code would be:

catplot(x = 'birthYear', col = "gender", data = data, hue = 'gender', kind = "count")

This option uses 'birthYear' on the x-axis and differentiates between genders using colors via the hue parameter, which is what you need for the visualization described.