### Quickstart: Load and plot example dataset Source: https://seaborn.pydata.org/installing.html Load the 'penguins' dataset and create a pairplot to test your Seaborn installation. This requires seaborn and matplotlib. ```python import seaborn as sns df = sns.load_dataset("penguins") sns.pairplot(df, hue="species") ``` -------------------------------- ### Load and inspect the 'tips' dataset Source: https://seaborn.pydata.org/generated/seaborn.relplot.html Loads the 'tips' dataset using seaborn and displays the first few rows to understand its structure. This is a common starting point for examples using this dataset. ```python import seaborn as sns tips = sns.load_dataset("tips") tips.head() ``` -------------------------------- ### Load and Inspect Tips Dataset Source: https://seaborn.pydata.org/generated/seaborn.scatterplot.html Loads the 'tips' dataset and displays the first few rows to understand its structure. This is a common starting point for Seaborn examples. ```python tips = sns.load_dataset("tips") tips.head() ``` -------------------------------- ### Load Example Dataset Source: https://seaborn.pydata.org/tutorial/introduction.html Load an example dataset into a Pandas DataFrame using `sns.load_dataset()`. This function provides easy access to sample data for examples. ```python # Load an example dataset tips = sns.load_dataset("tips") ``` -------------------------------- ### Basic Seaborn Plotting Example Source: https://seaborn.pydata.org/tutorial/introduction.html This example demonstrates the fundamental steps of using Seaborn: importing the library, setting a theme, loading a dataset, and creating a relational plot. ```python # Import seaborn import seaborn as sns # Apply the default theme sns.set_theme() # Load an example dataset tips = sns.load_dataset("tips") # Create a visualization sns.relplot( data=tips, x="total_bill", y="tip", col="time", hue="smoker", style="smoker", size="size", ) ``` -------------------------------- ### Basic clustermap usage Source: https://seaborn.pydata.org/generated/seaborn.clustermap.html This example demonstrates the basic usage of the clustermap function with a sample dataset. ```APIDOC ## clustermap ### Description Plots a clustered heatmap. ### Method `clustermap` ### Parameters - **data** (DataFrame or array-like) - The data to plot. - **z_score** (int or None) - If 0, center and scale along the columns. If 1, center and scale along the rows. If None, do not scale. - **cmap** (string) - The colormap to use for the heatmap. - **center** (float or None) - The value at which to center the colormap when plotting. ### Example ```python import seaborn as sns import matplotlib.pyplot as plt iris = sns.load_dataset("iris") sns.clustermap(iris, z_score=0, cmap="vlag", center=0) plt.show() ``` ``` -------------------------------- ### Install Seaborn with pip Source: https://seaborn.pydata.org/installing.html Use this command to install the latest stable release of Seaborn from PyPI. This will also install mandatory dependencies. ```bash pip install seaborn ``` -------------------------------- ### Install Seaborn with optional dependencies Source: https://seaborn.pydata.org/installing.html Install Seaborn along with optional dependencies like statsmodels for advanced regression plots. ```bash pip install seaborn[stats] ``` -------------------------------- ### seaborn.load_dataset Source: https://seaborn.pydata.org/generated/seaborn.load_dataset.html Loads an example dataset from the online repository. Requires internet access. Datasets are useful for documentation and reproducible examples. Some datasets may have preprocessing applied for categorical variable ordering. Use get_dataset_names() to see available datasets. ```APIDOC ## seaborn.load_dataset ### Description Load an example dataset from the online repository (requires internet). This function provides quick access to a small number of example datasets that are useful for documenting seaborn or generating reproducible examples for bug reports. It is not necessary for normal usage. Note that some of the datasets have a small amount of preprocessing applied to define a proper ordering for categorical variables. Use `get_dataset_names()` to see a list of available datasets. ### Parameters * **name** (str) - Name of the dataset (`{name}.csv` on https://github.com/mwaskom/seaborn-data). * **cache** (boolean, optional) - If True, try to load from the local cache first, and save to the cache if a download is required. * **data_home** (string, optional) - The directory in which to cache data; see `get_data_home()`. * **kws** (keys and values, optional) - Additional keyword arguments are passed to passed through to `pandas.read_csv()`. ### Returns * **df** (pandas.DataFrame) - Tabular data, possibly with some preprocessing applied. ``` -------------------------------- ### Get Dataset Names Source: https://seaborn.pydata.org/generated/seaborn.get_dataset_names.html Retrieves a list of available example datasets in seaborn. This function requires an active internet connection. ```APIDOC ## get_dataset_names() ### Description Report available example datasets, useful for reporting issues. Requires an internet connection. ### Method `get_dataset_names()` ### Parameters This function does not accept any parameters. ### Returns - list: A list of strings, where each string is the name of an available dataset. ``` -------------------------------- ### Customize cubehelix palette with start and rotation Source: https://seaborn.pydata.org/tutorial/color_palettes.html Adjust the `start` and `rot` parameters to control the hue and intensity variations in the cubehelix palette. ```python sns.cubehelix_palette(start=.5, rot=-.5, as_cmap=True) ``` -------------------------------- ### Stack Transform Example Source: https://seaborn.pydata.org/generated/seaborn.objects.Stack.html Demonstrates how to use the Stack transform with Bar marks to count occurrences within categories. ```APIDOC ## Stack Transform ### Description Displaces overlapping bar or area marks along the value axis to eliminate overlap. ### Usage ```python so.Stack() ``` ### Example ```python so.Plot(titanic, x="class", color="sex").add(so.Bar(), so.Count(), so.Stack()) ``` ``` -------------------------------- ### Get Light Sequential Gradient Source: https://seaborn.pydata.org/generated/seaborn.color_palette.html Return a light sequential gradient. ```python sns.color_palette("light:#5A9", as_cmap=True) ``` -------------------------------- ### get_dataset_names Source: https://seaborn.pydata.org/api.html Report available example datasets, useful for reporting issues. This function lists the names of datasets that can be loaded. ```APIDOC ## get_dataset_names ### Description Report available example datasets, useful for reporting issues. ### Method (Not specified, typically a function call in a Python SDK) ### Endpoint (Not applicable for SDK functions) ### Parameters (Parameters not explicitly detailed in the source text) ### Request Example (Not applicable for SDK functions) ### Response (Not applicable for SDK functions) ``` -------------------------------- ### load_dataset Source: https://seaborn.pydata.org/api.html Load an example dataset from the online repository (requires internet). This function downloads and loads sample datasets for use with Seaborn. ```APIDOC ## load_dataset ### Description Load an example dataset from the online repository (requires internet). ### Method (Not specified, typically a function call in a Python SDK) ### Endpoint (Not applicable for SDK functions) ### Parameters (Parameters not explicitly detailed in the source text) ### Request Example (Not applicable for SDK functions) ### Response (Not applicable for SDK functions) ``` -------------------------------- ### Import Seaborn Library Source: https://seaborn.pydata.org/tutorial/introduction.html Import the seaborn library using the conventional alias 'sns'. This is the only import needed for basic examples. ```python # Import seaborn import seaborn as sns ``` -------------------------------- ### light_palette Source: https://seaborn.pydata.org/api.html Make a sequential palette that blends from light to `color`. This function creates a sequential palette starting from a light color. ```APIDOC ## light_palette ### Description Make a sequential palette that blends from light to `color`. ### Method (Not specified, typically a function call in a Python SDK) ### Endpoint (Not applicable for SDK functions) ### Parameters (Parameters not explicitly detailed in the source text) ### Request Example (Not applicable for SDK functions) ### Response (Not applicable for SDK functions) ``` -------------------------------- ### Draw a taller rug Source: https://seaborn.pydata.org/generated/seaborn.rugplot.html This example demonstrates how to adjust the `height` parameter to control the length of the rug ticks, making them more prominent or less obtrusive as needed. ```python sns.scatterplot(data=tips, x="total_bill", y="tip") sns.rugplot(data=tips, x="total_bill", y="tip", height=.1) ``` -------------------------------- ### Evaluating KDE at Datapoints Source: https://seaborn.pydata.org/generated/seaborn.objects.KDE.html Shows how to evaluate the KDE directly at the original datapoints by setting `gridsize=None`. This can be useful for specific analyses where a continuous grid is not necessary. ```python p = so.Plot(penguins, x="flipper_length_mm") p.add(so.Dots(), so.KDE(gridsize=None)) ``` -------------------------------- ### Get Palette Colors as Hex Codes Source: https://seaborn.pydata.org/generated/seaborn.color_palette.html See the underlying color values of a palette as hex codes. This example uses the 'pastel6' palette. ```python print(sns.color_palette("pastel6").as_hex()) ``` ```text ['#a1c9f4', '#8de5a1', '#ff9f9b', '#d0bbff', '#fffea3', '#b9f2f0'] ``` -------------------------------- ### Override Context Parameters Source: https://seaborn.pydata.org/generated/seaborn.set_context.html Customize a specific parameter within a chosen context. This example sets the 'notebook' context and overrides the default line width to 3. ```python sns.set_context("notebook", rc={"lines.linewidth": 3}) sns.lineplot(x=[0, 1, 2], y=[1, 3, 2]) ``` -------------------------------- ### Initialize FacetGrid with data Source: https://seaborn.pydata.org/generated/seaborn.FacetGrid.__init__.html Load a dataset and initialize a FacetGrid object. This step sets up the grid structure but does not produce any plots. ```python tips = sns.load_dataset("tips") sns.FacetGrid(tips) ``` -------------------------------- ### Cubehelix Color System Source: https://seaborn.pydata.org/tutorial/properties.html The cubehelix color system can be used for continuous scales, offering control over start, rotation, and saturation. This example demonstrates its usage. ```python alt.Color('value:Q', scale=alt.Scale(scheme='ch:start=.2,rot=-.4')) ``` -------------------------------- ### Categorical Scatterplot with Swarmplot Source: https://seaborn.pydata.org/examples/scatterplot_categorical.html Use `swarmplot` to draw a categorical scatterplot. This example loads the penguins dataset and visualizes body mass by sex, differentiating points by species. Ensure the `seaborn` library is installed and imported. ```python import seaborn as sns sns.set_theme(style="whitegrid", palette="muted") # Load the penguins dataset df = sns.load_dataset("penguins") # Draw a categorical scatterplot to show each observation ax = sns.swarmplot(data=df, x="body_mass_g", y="sex", hue="species") ax.set(ylabel="") ``` -------------------------------- ### Initialize PairGrid with default settings Source: https://seaborn.pydata.org/generated/seaborn.PairGrid.__init__.html Calling the constructor sets up a blank grid of subplots with each row and one column corresponding to a numeric variable in the dataset. ```python penguins = sns.load_dataset("penguins") g = sns.PairGrid(penguins) ``` -------------------------------- ### choose_light_palette Source: https://seaborn.pydata.org/api.html Launch an interactive widget to create a light sequential palette. This function opens a widget for creating light sequential palettes. ```APIDOC ## choose_light_palette ### Description Launch an interactive widget to create a light sequential palette. ### Method (Not specified, typically a function call in a Python SDK) ### Endpoint (Not applicable for SDK functions) ### Parameters (Parameters not explicitly detailed in the source text) ### Request Example (Not applicable for SDK functions) ### Response (Not applicable for SDK functions) ``` -------------------------------- ### choose_cubehelix_palette Source: https://seaborn.pydata.org/api.html Launch an interactive widget to create a sequential cubehelix palette. This function opens a widget for creating cubehelix palettes. ```APIDOC ## choose_cubehelix_palette ### Description Launch an interactive widget to create a sequential cubehelix palette. ### Method (Not specified, typically a function call in a Python SDK) ### Endpoint (Not applicable for SDK functions) ### Parameters (Parameters not explicitly detailed in the source text) ### Request Example (Not applicable for SDK functions) ### Response (Not applicable for SDK functions) ``` -------------------------------- ### Install Seaborn with conda Source: https://seaborn.pydata.org/installing.html Install Seaborn from the Anaconda distribution using the conda package manager. ```bash conda install seaborn ``` -------------------------------- ### Install Seaborn from conda-forge Source: https://seaborn.pydata.org/installing.html Install Seaborn from the conda-forge channel for potentially newer releases than the main Anaconda repository. ```bash conda install seaborn -c conda-forge ``` -------------------------------- ### Configure PairGrid Aesthetics and Palette Source: https://seaborn.pydata.org/tutorial/axis_grids.html Initialize a PairGrid with the 'tips' dataset, coloring by 'size' using the 'GnBu_d' palette. Maps scatterplots with custom size and edge color, and adds a legend. ```python g = sns.PairGrid(tips, hue="size", palette="GnBu_d") g.map(plt.scatter, s=50, edgecolor="white") g.add_legend() ``` -------------------------------- ### Change the starting hue of the helix Source: https://seaborn.pydata.org/generated/seaborn.cubehelix_palette.html Adjust the `start` parameter to modify the hue value at the beginning of the color helix. ```python sns.cubehelix_palette(start=2) ``` -------------------------------- ### Basic KDE Plot Source: https://seaborn.pydata.org/generated/seaborn.objects.KDE.html This example shows how to add a Kernel Density Estimate (KDE) to a plot using the Area mark. It visualizes the density distribution of the 'flipper_length_mm' data. ```python p = so.Plot(penguins, x="flipper_length_mm") p.add(so.Area(), so.KDE()) ``` -------------------------------- ### Initializing JointGrid with Customizations Source: https://seaborn.pydata.org/generated/seaborn.JointGrid.__init__.html Demonstrates how to initialize a `JointGrid` object, controlling the display of marginal ticks and setting axis limits. ```APIDOC ## seaborn.JointGrid.__init__ ### Description Initializes a `JointGrid` object, which is a figure-level object that can hold a `JointGrid` plot. ### Parameters #### Keyword Arguments - **marginal_ticks** (bool, optional) - If True, display ticks on the marginal axes. Defaults to False. - **xlim** (tuple of (lower, upper), optional) - Set the limits for the x-axis. - **ylim** (tuple of (lower, upper), optional) - Set the limits for the y-axis. ### Usage Examples #### Enabling marginal ticks: ```python sns.JointGrid(marginal_ticks=True) ``` #### Setting axis limits: ```python sns.JointGrid(xlim=(-2, 5), ylim=(0, 10)) ``` ``` -------------------------------- ### Install Seaborn in Jupyter Notebook Source: https://seaborn.pydata.org/faq.html Use this command within a Jupyter notebook to ensure Seaborn is installed in the same environment as the notebook kernel. ```python %pip install ``` -------------------------------- ### Adjusting KDE Smoothing Bandwidth Source: https://seaborn.pydata.org/generated/seaborn.objects.KDE.html Demonstrates how to adjust the smoothing bandwidth of the KDE using the `bw_adjust` parameter. Increasing this value results in a smoother curve, while decreasing it reveals more details. ```python p = so.Plot(penguins, x="flipper_length_mm") p.add(so.Area(), so.KDE(bw_adjust=0.25)) ``` -------------------------------- ### Change Hue Start Point in HLS Palette Source: https://seaborn.pydata.org/generated/seaborn.hls_palette.html Modify the starting point for hue sampling by adjusting the `h` parameter, which should be between 0 and 1. ```python sns.hls_palette(h=.5) ``` -------------------------------- ### Apply light palette using color_palette() Source: https://seaborn.pydata.org/tutorial/color_palettes.html Use `color_palette()` with a 'light:' prefix to create a light sequential palette based on a single color. ```python sns.color_palette("light:b", as_cmap=True) ``` -------------------------------- ### Initialize FacetGrid Source: https://seaborn.pydata.org/generated/seaborn.FacetGrid.html Initialize the grid with a long-form data object. This sets up the structure but does not plot anything. ```python import seaborn as sns tips = sns.load_dataset("tips") sns.FacetGrid(tips) ``` -------------------------------- ### Generate HUSL Palette with Different Hue Start Source: https://seaborn.pydata.org/generated/seaborn.husl_palette.html Change the starting point for hue sampling by providing a float value between 0 and 1 for the `h` parameter. ```python sns.husl_palette(h=.5) ``` -------------------------------- ### apply Source: https://seaborn.pydata.org/generated/seaborn.PairGrid.html Pass the grid to a user-supplied function and return self. ```APIDOC ## apply ### Description Pass the grid to a user-supplied function and return self. ### Method `apply` ### Parameters - **func**: callable - **args**: positional arguments - **kwargs**: keyword arguments ### Example ```python import seaborn as sns import matplotlib.pyplot as plt def set_title(ax, title): ax.set_title(title) penguins = sns.load_dataset("penguins") g = sns.PairGrid(penguins) g.map_diag(sns.histplot) g.map_offdiag(sns.scatterplot) g.apply(set_title, title="Pair Plot") plt.show() ``` ``` -------------------------------- ### Generate a discrete palette with default parameters Source: https://seaborn.pydata.org/generated/seaborn.cubehelix_palette.html Use the default settings to create a discrete color palette. ```python sns.cubehelix_palette() ``` -------------------------------- ### Import necessary libraries and set theme Source: https://seaborn.pydata.org/tutorial/relational.html Import numpy, pandas, matplotlib, and seaborn. Set the Seaborn theme to 'darkgrid'. ```python import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns sns.set_theme(style="darkgrid") ``` -------------------------------- ### Get Customized Cubehelix Palette Source: https://seaborn.pydata.org/generated/seaborn.color_palette.html Return a customized cubehelix color palette. ```python sns.color_palette("ch:s=.25,rot=-.25", as_cmap=True) ``` -------------------------------- ### FacetGrid.__init__() Source: https://seaborn.pydata.org/generated/seaborn.FacetGrid.html Initializes a FacetGrid object, which is used to plot data across a factorial grid of Axes. ```APIDOC ## FacetGrid.__init__() ### Description Initializes a FacetGrid object. This object can be used to plot data across a factorial grid of Axes, making it easy to visualize relationships within subsets of your data. ### Method __init__ ### Parameters This method does not explicitly list parameters in the provided source. Refer to the Seaborn documentation for detailed parameter information. ``` -------------------------------- ### Get Blend Gradient Between Two Endpoints Source: https://seaborn.pydata.org/generated/seaborn.color_palette.html Return a blend gradient between two endpoints. ```python sns.color_palette("blend:#7AB,#EDA", as_cmap=True) ``` -------------------------------- ### PairGrid with Histplot and Scatterplot Source: https://seaborn.pydata.org/generated/seaborn.PairGrid.__init__.html This example demonstrates how to initialize a PairGrid, map a histogram to the diagonal axes with stacked elements, and a scatterplot to the off-diagonal axes. A legend is then added to distinguish between different categories. ```python g = sns.PairGrid(penguins, hue="species") g.map_diag(sns.histplot, multiple="stack", element="step") g.map_offdiag(sns.scatterplot) g.add_legend() ``` -------------------------------- ### Get Reversed Dark Sequential Gradient Source: https://seaborn.pydata.org/generated/seaborn.color_palette.html Return a reversed dark sequential gradient. ```python sns.color_palette("dark:#5A9_r", as_cmap=True) ``` -------------------------------- ### KDE Grouped by Variable Source: https://seaborn.pydata.org/generated/seaborn.objects.KDE.html Illustrates how to group KDE estimations by another variable, in this case, 'species'. This allows for comparing density distributions across different categories. ```python p = so.Plot(penguins, x="flipper_length_mm") p.add(so.Area(), so.KDE(), color="species") ``` -------------------------------- ### Adjusting KDE Grid Resolution Source: https://seaborn.pydata.org/generated/seaborn.objects.KDE.html Demonstrates how to control the resolution of the grid where the KDE is evaluated using the `gridsize` parameter. A higher `gridsize` increases resolution. ```python p = so.Plot(penguins, x="flipper_length_mm") p.add(so.Dots(), so.KDE(gridsize=100)) ``` -------------------------------- ### Basic FacetGrid Initialization Source: https://seaborn.pydata.org/generated/seaborn.FacetGrid.__init__.html Initialize a FacetGrid with a dataset and specify variables for columns and rows to create subplots. ```APIDOC ## sns.FacetGrid(data, col=None, row=None, ...) ### Description Initialize a FacetGrid object to map plotting functions over subsets of a dataset. ### Parameters - **data** (DataFrame or dict) - Tidy-plotted data or a dict of arrays. - **col** (string, optional) - Variable in `data` to map onto the columns of the grid. - **row** (string, optional) - Variable in `data` to map onto the rows of the grid. ### Example ```python sns.FacetGrid(tips, col="time", row="sex") ``` ``` -------------------------------- ### Get Color Brewer Palette Source: https://seaborn.pydata.org/generated/seaborn.color_palette.html Return all unique colors in a categorical Color Brewer palette. ```python sns.color_palette("Set2") ``` -------------------------------- ### Create a light palette from a color name Source: https://seaborn.pydata.org/generated/seaborn.light_palette.html Use this to generate a default sequential palette blending from light to 'seagreen'. ```python sns.light_palette("seagreen") ``` -------------------------------- ### Color Palette Specification Source: https://seaborn.pydata.org/tutorial/properties.html Color scales can be parameterized by the name of a palette. This example uses the 'viridis' palette. ```python alt.Color('value:Q', scale=alt.Scale(palette='viridis')) ``` -------------------------------- ### Basic Joint Plot Source: https://seaborn.pydata.org/generated/seaborn.jointplot.html A basic example of `jointplot` showing the relationship between two variables with marginal histograms. ```APIDOC ## sns.jointplot ### Description Plots the relationship between two variables with marginal distributions. ### Parameters - **data** (DataFrame or array-like) - Dataset for plotting. - **x** (string or int) - Variable name for the x-axis. - **y** (string or int) - Variable name for the y-axis. - **height** (int, optional) - Size of the figure in inches. - **ratio** (int, optional) - Ratio of joint axes height to marginal axes height. - **marginal_ticks** (bool, optional) - If True, show marginal ticks. ### Request Example ```python import seaborn as sns import pandas as pd # Assuming 'penguins' DataFrame is available # penguins = sns.load_dataset("penguins") sns.jointplot(data=penguins, x="bill_length_mm", y="bill_depth_mm", height=5, ratio=2, marginal_ticks=True) ``` ### Response Returns a `JointGrid` object which can be used for further customization. ``` -------------------------------- ### Get Seaborn Categorical Palette by Name Source: https://seaborn.pydata.org/generated/seaborn.color_palette.html Reference other variants on the seaborn categorical color palette by name. ```python sns.color_palette("pastel") ``` -------------------------------- ### Show density with thinner lines and alpha blending Source: https://seaborn.pydata.org/generated/seaborn.rugplot.html This example demonstrates how to use `lw` (linewidth) and `alpha` parameters with a large dataset to visualize density with very thin, semi-transparent lines, effectively showing the distribution without overwhelming the plot. ```python diamonds = sns.load_dataset("diamonds") sns.scatterplot(data=diamonds, x="carat", y="price", s=5) sns.rugplot(data=diamonds, x="carat", y="price", lw=1, alpha=.005) ``` -------------------------------- ### Paths Mark Initialization Source: https://seaborn.pydata.org/generated/seaborn.objects.Paths.html Initializes the Paths mark with customizable properties. ```APIDOC ## Paths() ### Description A faster but less-flexible mark for drawing many paths. ### Properties - `_artist_kws` (factory): Keyword arguments passed to the underlying artist. - `_color` (str, optional): The color of the paths. Defaults to 'C0'. - `_alpha` (float, optional): The transparency of the paths. Defaults to 1. - `_linewidth` (float, optional): The width of the paths. Defaults to rcParams['lines.linewidth']. - `_linestyle` (str, optional): The style of the paths. Defaults to rcParams['lines.linestyle']. ``` -------------------------------- ### Interpolated Color Scale Source: https://seaborn.pydata.org/tutorial/properties.html Continuous scales can be parameterized by a tuple of colors to interpolate between. This example interpolates between blue and red. ```python alt.Color('value:Q', scale=alt.Scale(range=['blue', 'red'])) ``` -------------------------------- ### Customizing Lines Mark with Properties Source: https://seaborn.pydata.org/generated/seaborn.objects.Lines.html Illustrates how to customize the appearance of lines using properties like `linewidth` and `color`, and how to combine multiple `Lines` marks with different styles. ```APIDOC ## Customizing Lines Mark with Properties ### Description This example demonstrates customizing the `so.Lines()` mark with specific aesthetic properties such as `linewidth` and `color`. It also shows how to layer multiple `Lines` marks with different configurations on the same plot, potentially for comparison or highlighting. ### Method `add(so.Lines(linewidth=..., color=...)) ### Parameters - **linewidth** (float) - Controls the thickness of the lines. - **color** (str) - Sets the color of the lines. ### Request Example ```python (so.Plot( x=seaice["Date"].dt.day_of_year, y=seaice["Extent"], color=seaice["Date"].dt.year ) .facet(seaice["Date"].dt.year.round(-1)) .add(so.Lines(linewidth=.5, color="#bbca"), col=None) .add(so.Lines(linewidth=1)) .scale(color="ch:rot=-.2,light=.7") .layout(size=(8, 4)) .label(title="{}s".format) ) ``` ### Response This operation generates a faceted plot where each facet displays lines with customized styles, potentially showing trends over different years or groups. ``` -------------------------------- ### get_data_home Source: https://seaborn.pydata.org/api.html Return a path to the cache directory for example datasets. This function provides the location where datasets are stored locally. ```APIDOC ## get_data_home ### Description Return a path to the cache directory for example datasets. ### Method (Not specified, typically a function call in a Python SDK) ### Endpoint (Not applicable for SDK functions) ### Parameters (Parameters not explicitly detailed in the source text) ### Request Example (Not applicable for SDK functions) ### Response (Not applicable for SDK functions) ``` -------------------------------- ### Configuring ticks and labels with scale objects Source: https://seaborn.pydata.org/generated/seaborn.objects.Plot.scale.html Illustrates advanced configuration of tick locations and label formatting using scale objects and their methods. ```APIDOC ## Plot.scale() ### Description Specify mappings from data units to visual properties. ### Method `scale(self, _** scales)` ### Parameters * `_** scales`: Keyword arguments where keys are plot variables (e.g., `x`, `y`, `color`) and values specify the scale mapping. ### Example ```python ( p1.add(so.Dots(), color="price") .scale( x=so.Continuous(trans="sqrt").tick(every=.5), y=so.Continuous().label(like="${x:g}"), color=so.Continuous("ch:.2").tick(upto=4).label(unit=""), ) .label(y="") ) ``` ``` -------------------------------- ### Using scale() with palette names Source: https://seaborn.pydata.org/generated/seaborn.objects.Plot.scale.html Shows how to set a color scale using a named palette like "crest". ```APIDOC ## Plot.scale() ### Description Specify mappings from data units to visual properties. ### Method `scale(self, _** scales)` ### Parameters * `_** scales`: Keyword arguments where keys are plot variables (e.g., `x`, `y`, `color`) and values specify the scale mapping. ### Example ```python p1.add(so.Dots(), color="clarity").scale(color="crest") ``` ``` -------------------------------- ### Boxenplot with linear width method Source: https://seaborn.pydata.org/generated/seaborn.boxenplot.html This example illustrates how to control the width of each box in a boxenplot by setting the 'width_method' to 'linear'. ```python sns.boxenplot(data=diamonds, x="price", y="clarity", width_method="linear") ``` -------------------------------- ### Get Perceptually Uniform Palette as Colormap Source: https://seaborn.pydata.org/generated/seaborn.color_palette.html Return one of the perceptually-uniform palettes included in seaborn as a continuous colormap. ```python sns.color_palette("flare", as_cmap=True) ``` -------------------------------- ### Get Diverging Color Brewer Palette as Colormap Source: https://seaborn.pydata.org/generated/seaborn.color_palette.html Return a diverging Color Brewer palette as a continuous colormap. ```python sns.color_palette("Spectral", as_cmap=True) ``` -------------------------------- ### plotting_context Source: https://seaborn.pydata.org/api.html Get the parameters that control the scaling of plot elements. This function retrieves the current plotting context parameters. ```APIDOC ## plotting_context ### Description Get the parameters that control the scaling of plot elements. ### Method (Not specified, typically a function call in a Python SDK) ### Endpoint (Not applicable for SDK functions) ### Parameters (Parameters not explicitly detailed in the source text) ### Request Example (Not applicable for SDK functions) ### Response (Not applicable for SDK functions) ``` -------------------------------- ### Using scale() with Continuous scale object Source: https://seaborn.pydata.org/generated/seaborn.objects.Plot.scale.html Shows how to use the `so.Continuous` scale object for detailed control over transform, domain, and range. ```APIDOC ## Plot.scale() ### Description Specify mappings from data units to visual properties. ### Method `scale(self, _** scales)` ### Parameters * `_** scales`: Keyword arguments where keys are plot variables (e.g., `x`, `y`, `color`) and values specify the scale mapping. ### Example ```python ( p1.add(so.Dots(), color="carat") .scale(color=so.Continuous((".4", "#68d"), norm=(1, 3), trans="sqrt")) ) ``` ``` -------------------------------- ### axes_style Source: https://seaborn.pydata.org/api.html Get the parameters that control the general style of the plots. This function retrieves the current plotting style parameters. ```APIDOC ## axes_style ### Description Get the parameters that control the general style of the plots. ### Method (Not specified, typically a function call in a Python SDK) ### Endpoint (Not applicable for SDK functions) ### Parameters (Parameters not explicitly detailed in the source text) ### Request Example (Not applicable for SDK functions) ### Response (Not applicable for SDK functions) ``` -------------------------------- ### Band Class Initialization Source: https://seaborn.pydata.org/generated/seaborn.objects.Band.html Initialize a Band mark with various aesthetic properties to control its appearance. ```APIDOC ## seaborn.objects.Band ### Description A fill mark representing an interval between values. This mark defines the following properties: color, alpha, fill, edgecolor, edgealpha, edgewidth, edgestyle ### Parameters * `_artist_kws` (_dict_) - Artist keyword arguments. * `_color` (_str_) - Default: 'C0'. The color of the mark. * `_alpha` (_float_) - Default: 0.2. The transparency of the mark. * `_fill` (_bool_) - Default: True. Whether to fill the band. * `_edgecolor` (_str_) - Default: depend:color. The color of the band's edge. * `_edgealpha` (_float_) - Default: 1. The transparency of the band's edge. * `_edgewidth` (_float_) - Default: 0. The width of the band's edge. * `_edgestyle` (_str_) - Default: '-'. The style of the band's edge. ### See Also `Area`: A fill mark drawn from a baseline to data values. ### Examples ```python p = so.Plot(seaice, x="Day", ymin="1980", ymax="2019") p.add(so.Band()) ``` By default it draws a faint ribbon with no edges, but edges can be added: ```python p.add(so.Band(alpha=.5, edgewidth=2)) ``` The defaults are optimized for the main expected usecase, where the mark is combined with a line to show an errorbar interval: ```python ( so.Plot(fmri, x="timepoint", y="signal", color="event") .add(so.Band(), so.Est()) .add(so.Line(), so.Agg()) ) ``` When min/max values are not explicitly assigned or added in a transform, the band will cover the full extent of the data: ```python ( so.Plot(fmri, x="timepoint", y="signal", color="event") .add(so.Line(linewidth=.5), group="subject") .add(so.Band()) ) ``` ``` -------------------------------- ### Using the 'hue' semantic Source: https://seaborn.pydata.org/generated/seaborn.JointGrid.__init__.html Initialize a JointGrid with a `hue` variable to map semantic information to color. This allows for visualizing subgroups within the data. ```python g = sns.JointGrid(data=penguins, x="bill_length_mm", y="bill_depth_mm", hue="species") g.plot(sns.scatterplot, sns.histplot) ``` -------------------------------- ### Get Current Color Cycle Source: https://seaborn.pydata.org/generated/seaborn.color_palette.html Calling color_palette() with no arguments returns all colors from the current default color cycle. ```python sns.color_palette() ``` -------------------------------- ### Applying scale() before limit() Source: https://seaborn.pydata.org/generated/seaborn.objects.Plot.scale.html Demonstrates the order of operations where a scale transform is applied before data limits are set. ```APIDOC ## Plot.scale() ### Description Specify mappings from data units to visual properties. ### Method `scale(self, _** scales)` ### Parameters * `_** scales`: Keyword arguments where keys are plot variables (e.g., `x`, `y`, `color`) and values specify the scale mapping. ### Example ```python ( p1.add(so.Dots(color=".7")) .add(so.Line(), so.PolyFit(order=2)) .scale(y="log") .limit(y=(250, 25000)) ) ``` ``` -------------------------------- ### Basic Lines Plot Source: https://seaborn.pydata.org/generated/seaborn.objects.Lines.html Draws a connecting line between sorted observations using the Lines mark. This is a fundamental usage example. ```python so.Plot(seaice, "Date", "Extent").add(so.Lines()) ``` -------------------------------- ### Using scale() with a tuple for range Source: https://seaborn.pydata.org/generated/seaborn.objects.Plot.scale.html Illustrates setting the output range for a point size scale using a tuple of minimum and maximum values. ```APIDOC ## Plot.scale() ### Description Specify mappings from data units to visual properties. ### Method `scale(self, _** scales)` ### Parameters * `_** scales`: Keyword arguments where keys are plot variables (e.g., `x`, `y`, `color`) and values specify the scale mapping. ### Example ```python p1.add(so.Dots(), pointsize="carat").scale(pointsize=(2, 10)) ``` ``` -------------------------------- ### Median Estimate with Est Source: https://seaborn.pydata.org/generated/seaborn.objects.Est.html Select other estimators by name if they are pandas methods. This example shows how to compute the median instead of the mean. ```python p.add(so.Range(), so.Est("median")) ``` -------------------------------- ### choose_dark_palette Source: https://seaborn.pydata.org/api.html Launch an interactive widget to create a dark sequential palette. This function opens a widget for creating dark sequential palettes. ```APIDOC ## choose_dark_palette ### Description Launch an interactive widget to create a dark sequential palette. ### Method (Not specified, typically a function call in a Python SDK) ### Endpoint (Not applicable for SDK functions) ### Parameters (Parameters not explicitly detailed in the source text) ### Request Example (Not applicable for SDK functions) ### Response (Not applicable for SDK functions) ``` -------------------------------- ### Handling Empty Space with Dodge Source: https://seaborn.pydata.org/generated/seaborn.objects.Dodge.html Demonstrates how the `empty` parameter in `so.Dodge` can be used to manage space when data is not fully crossed. Use 'fill' to expand marks and 'drop' to center them. ```python p = so.Plot(tips, "day", color="time") p.add(so.Bar(), so.Count(), so.Dodge()) ``` ```python p.add(so.Bar(), so.Count(), so.Dodge(empty="fill")) ``` ```python p.add(so.Bar(), so.Count(), so.Dodge(empty="drop")) ``` -------------------------------- ### Draw a single horizontal boxenplot Source: https://seaborn.pydata.org/generated/seaborn.boxenplot.html This example demonstrates how to create a basic horizontal boxenplot by assigning data directly to the x-axis. ```python sns.boxenplot(x=diamonds["price"]) ``` -------------------------------- ### Change luminance at start and end points Source: https://seaborn.pydata.org/generated/seaborn.cubehelix_palette.html Control the intensity of the darkest and lightest colors using the `dark` and `light` parameters. ```python sns.cubehelix_palette(dark=.25, light=.75) ``` -------------------------------- ### Generate Sequential Color Brewer palette (multi-hue) Source: https://seaborn.pydata.org/tutorial/color_palettes.html Apply a sequential palette from the Color Brewer library that features multiple hues, like 'YlOrBr'. ```python sns.color_palette("YlOrBr", as_cmap=True) ``` -------------------------------- ### KDE with Stack Transform Source: https://seaborn.pydata.org/generated/seaborn.objects.KDE.html Shows how the KDE stat can be combined with the `Stack` transform. This is possible when `common_grid=True`, allowing for stacked density plots. ```python p = so.Plot(penguins, x="flipper_length_mm") p.add(so.Area(), so.KDE(), so.Stack(), color="sex") ``` -------------------------------- ### dark_palette Source: https://seaborn.pydata.org/api.html Make a sequential palette that blends from dark to `color`. This function creates a sequential palette starting from a dark color. ```APIDOC ## dark_palette ### Description Make a sequential palette that blends from dark to `color`. ### Method (Not specified, typically a function call in a Python SDK) ### Endpoint (Not applicable for SDK functions) ### Parameters (Parameters not explicitly detailed in the source text) ### Request Example (Not applicable for SDK functions) ### Response (Not applicable for SDK functions) ```