Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import matplotlib.pyplot as plt # Data age_groups = ['18-24', '25-34', '35-44', '45-54', '55-64', '65+'] apple_owners = [0.29, 0.23, 0.20, 0.19, 0.14, 0.09] non_apple_owners = [0.13,

import matplotlib.pyplot as plt

# Data age_groups = ['18-24', '25-34', '35-44', '45-54', '55-64', '65+'] apple_owners = [0.29, 0.23, 0.20, 0.19, 0.14, 0.09] non_apple_owners = [0.13, 0.10, 0.09, 0.09, 0.08, 0.05]

# Plotting fig, ax = plt.subplots(figsize=(10, 6)) bar_width = 0.35 opacity = 0.8

rects1 = ax.bar(age_groups, apple_owners, bar_width, alpha=opacity, color='blue', label='Apple Device Owners') rects2 = ax.bar([i + bar_width for i in range(len(age_groups))], non_apple_owners, bar_width, alpha=opacity, color='green', label='Non-Apple Device Owners')

# Labels and Legends ax.set_xlabel('Age Groups') ax.set_ylabel('Likelihood of Subscribing') ax.set_title('Likelihood of Subscribing to Apple TV by Device Ownership and Age Group') ax.set_xticks([i + bar_width/2 for i in range(len(age_groups))]) ax.set_xticklabels(age_groups) ax.legend()

# Displaying the Plot plt.show() pls help me to create bar graph

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Managerial Economics and Business Strategy

Authors: Michael R. baye

7th Edition

978-0073375960, 71267441, 73375969, 978-0071267441

More Books

Students also viewed these Economics questions