This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#### MATPLOTLIBRC FORMAT | |
## This is a sample matplotlib configuration file - you can find a copy | |
## of it on your system in | |
## site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it | |
## there, please note that it will be overwritten in your next install. | |
## If you want to keep a permanent local copy that will not be | |
## overwritten, place it in the following location: | |
## unix/linux: | |
## $HOME/.config/matplotlib/matplotlibrc or |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import seaborn as sns | |
tips = sns.load_dataset("tips") # Load data | |
# Scatterplot with matplotlib | |
for is_smoker in tips.smoker.unique(): | |
is_smoker_data = tips.query('smoker == @is_smoker') | |
plt.scatter(is_smoker_data['total_bill'], is_smoker_data['tip'], edgecolors='w', label=f'{is_smoker}') | |
plt.legend(title='Smoker') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import seaborn as sns | |
tips = sns.load_dataset("tips") # Load data | |
fig, axs = plt.subplots(1, 2) # Create subplots | |
# Boxplot with matplotlib | |
tips_box = [tips.query('day == @day')['total_bill'] for day in tips.day.unique()] | |
axs[0].boxplot(tips_box, labels=tips.day.unique()) |