Building up the barplot

Python for Spreadsheet Users

Chris Cardillo

Data Scientist

Previous barplot

sns.barplot(x='store', y='revenue', data=totals)

plt.show()

store totals plot only.png

Python for Spreadsheet Users

Adding labels

sns.barplot(x='store', 
            y='revenue', 
            data=totals)

# Add a title

# Add x-axis label

# Add y-axis label

plt.show()

store totals plot only.png

Python for Spreadsheet Users

Adding a title with plt.title()

sns.barplot(x='store', 
            y='revenue', 
            data=totals)

plt.title('Revenue by Store')

# Add x-axis label

# Add y-axis label

plt.show()

Revenue by Store with title.png

Python for Spreadsheet Users

Adding an x-axis label with plt.xlabel()

sns.barplot(x='store', 
            y='revenue', 
            data=totals)

plt.title('Revenue by Store')

plt.xlabel('Store')

# Add y-axis label

plt.show()

Revenue by Store with title and xlab.png

Python for Spreadsheet Users

Adding an y-axis label with plt.ylabel()

sns.barplot(x='store', 
            y='revenue', 
            data=totals)

plt.title('Revenue by Store')

plt.xlabel('Store')

plt.ylabel('Revenue (USD)')

plt.show()

Revenue by Store with all labels.png

Python for Spreadsheet Users

Removing unwanted borders with sns.despine()

sns.barplot(x='store', 
            y='revenue', 
            data=totals)

plt.title('Revenue by Store')

plt.xlabel('Store')

plt.ylabel('Revenue (USD)')

sns.despine()

plt.show()

Revenue by Store less boarders.png

Python for Spreadsheet Users

Adding style with sns.set_style()

sns.set_style('whitegrid')

sns.barplot(x='store', 
            y='revenue', 
            data=totals)

plt.title('Revenue by Store')

plt.xlabel('Store')

plt.ylabel('Revenue (USD)')

sns.despine()

plt.show()

Revenue by Store Final.png

Python for Spreadsheet Users

Side by side

Before

store totals plot only.png

After

Revenue by Store Final.png

Python for Spreadsheet Users

Your turn!

Python for Spreadsheet Users

Preparing Video For Download...