반응형
반응형
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..
Grouped violinplots with split violins seaborn components used: set_theme(), load_dataset(), violinplot(), despine() import seaborn as sns sns.set_theme(style="whitegrid") # Load the example tips dataset tips = sns.load_dataset("tips") # Draw a nested violinplot and split the violins for easier comparison sns.violinplot(data=tips, x="day", y="total_bill", hue="smoker", split=True, inner="quart",..
Plotting on a large number of facets seaborn components used: set_theme(), FacetGrid import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt sns.set_theme(style="ticks") # Create a dataset with many short random walks rs = np.random.RandomState(4) pos = rs.randint(-1, 2, (20, 5)).cumsum(axis=1) pos -= pos[:, 0, np.newaxis] step = np.tile(range(5), 20) walk = ..
Timeseries plot with error bands seaborn components used: set_theme(), load_dataset(), lineplot() import seaborn as sns sns.set_theme(style="darkgrid") # Load an example dataset with long-form data fmri = sns.load_dataset("fmri") # Plot the responses for different events and regions sns.lineplot(x="timepoint", y="signal", hue="region", style="event", data=fmri) Lineplot from a wide-form dataset ..
Annotated heatmaps seaborn components used: set_theme(), load_dataset(), heatmap() import matplotlib.pyplot as plt import seaborn as sns sns.set_theme() # Load the example flights dataset and convert to long-form flights_long = sns.load_dataset("flights") flights = flights_long.pivot("month", "year", "passengers") # Draw a heatmap with the numeric values in each cell f, ax = plt.subplots(figsize..