In [1]:
from IPython.display import Image
Image("phone_providers-original.png", width=500)
Out[1]:
As the caption says, comparision between the various providers' offers is not easy with their visualization.
Especially, no one can see the relationship between data allowance and cost for the various providers, which is a useful information if people want to compare their current package with and/or select a new package.
This is what we aim to do with our visualization.
In [2]:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
In [5]:
# Create a DataFrame with the data
providers = ['AT&T', 'Verizon', 'Sprint']
provider_dict = dict(s='Sprint', a='AT&T', v='Verizon')
gb = [40, 30, 25, 24, 24, 16, 16, 12, 12, 10, 8, 6, 6, 4, 3, 3, 2, 1, 1]
cost = [100, 135, 110, 80, 110, 90, 90, 60, 80, 80, 70, 45, 60, 50, 30, 40, 35, 20, 30]
company = 'saasvavsvavsavsavsa'
data = pd.DataFrame({'data': gb, 'cost': cost, 'provider': [provider_dict[c] for c in company]})
In [6]:
# Using a combination of matplotlib styles to obtain a clean plot
plt.style.use('ggplot')
plt.style.use('seaborn-poster')
markers = 'od^'
fig, ax = plt.subplots(figsize=(10, 10))
for prov, marker in zip(providers, markers):
subdata = data.loc[data.provider == prov]
ax.plot(subdata.data, subdata.cost, '--'+marker, lw=1.5, ms=15, label=prov)
ax.legend(frameon=False)
ax.set_xlabel('Data allowance (GB)')
ax.set_ylabel('Cost ($)')
ax.set_xlim(0, 45)
ax.set_ylim(0, 150);
In [ ]: