반응형
반응형
Pair Grid Paired density and scatterplot matrix seaborn components used: set_theme(), load_dataset(), PairGrid import seaborn as sns sns.set_theme(style="white") df = sns.load_dataset("penguins") g = sns.PairGrid(df, diag_sharey=False) g.map_upper(sns.scatterplot, s=15) g.map_lower(sns.kdeplot) g.map_diag(sns.kdeplot, lw=2) Paired categorical plots seaborn components used: set_theme(), load_data..
Scatterplot with multiple semantics seaborn components used: set_theme(), load_dataset(), despine(), scatterplot() import seaborn as sns import matplotlib.pyplot as plt sns.set_theme(style="whitegrid") # Load the example diamonds dataset diamonds = sns.load_dataset("diamonds") # Draw a scatter plot while assigning point colors and sizes to different # variables in the dataset f, ax = plt.subplot..
Stacked histogram on a log scale seaborn components used: set_theme(), load_dataset(), despine(), histplot() import seaborn as sns import matplotlib as mpl import matplotlib.pyplot as plt sns.set_theme(style="ticks") diamonds = sns.load_dataset("diamonds") f, ax = plt.subplots(figsize=(7, 5)) sns.despine(f) sns.histplot( diamonds, x="price", hue="cut", multiple="stack", palette="light:m_r", edge..
Multiple bivariate KDE plots seaborn components used: set_theme(), load_dataset(), kdeplot() import seaborn as sns import matplotlib.pyplot as plt sns.set_theme(style="darkgrid") iris = sns.load_dataset("iris") # Set up the figure f, ax = plt.subplots(figsize=(8, 8)) ax.set_aspect("equal") # Draw a contour plot to represent each bivariate density sns.kdeplot( data=iris.query("species != 'versico..
Color palette choices seaborn components used: set_theme(), barplot(), barplot(), barplot(), despine() import numpy as np import seaborn as sns import matplotlib.pyplot as plt sns.set_theme(style="white", context="talk") rs = np.random.RandomState(8) # Set up the matplotlib figure f, (ax1, ax2, ax3) = plt.subplots(3, 1, figsize=(7, 5), sharex=True) # Generate some sequential data x = np.array(li..
Joint and marginal histograms seaborn components used: set_theme(), load_dataset(), JointGrid import seaborn as sns sns.set_theme(style="ticks") # Load the planets dataset and initialize the figure planets = sns.load_dataset("planets") g = sns.JointGrid(data=planets, x="year", y="distance", marginal_ticks=True) # Set a log scaling on the y axis g.ax_joint.set(yscale="log") # Create an inset lege..