### Install uv for Development Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/installation.md Install the uv tool, a fast Python package installer and resolver, which is recommended for development installations. Choose the script appropriate for your operating system. ```bash # macOS/Linux curl -LsSf https://astral.sh/uv/install.sh | sh ``` ```powershell # Windows powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" ``` -------------------------------- ### Install Build Essentials (Linux) Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/installation.md On Linux systems, if compilation fails, install the necessary build tools with this command. ```bash sudo apt-get install build-essential ``` -------------------------------- ### Configuration & Setup Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/api.md Provides functions for configuring matplotlib, scanpy, axes, and ggplot styles. ```APIDOC ## Configuration & Setup ### Description Provides functions for configuring plotting environments. ### Setup Functions - `setup_matplotlib` - `setup_scanpy` - `setup_ax` - `setup_ggplot` ``` -------------------------------- ### Clone Repository and Install for Development Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/installation.md Clone the cnsplots repository and use the provided Makefile with uv to install the package in editable mode, including development dependencies. ```bash git clone https://github.com/faridrashidi/cnsplots cd cnsplots make install ``` -------------------------------- ### Install Xcode Command Line Tools (macOS) Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/installation.md If you encounter compiler errors on macOS, install the Xcode Command Line Tools using this command. ```bash xcode-select --install ``` -------------------------------- ### Install cnsplots using pip Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/installation.md Use this command to install the cnsplots package from PyPI. Ensure you have Python 3.10+ and pip installed. ```bash pip install cnsplots ``` -------------------------------- ### Quick Start with cnsplots Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/index.md Demonstrates basic usage of cnsplots for creating a boxplot. Imports necessary libraries, sets figure dimensions, generates the plot, and saves it to a file. ```python import cnsplots as cns import seaborn as sns df = sns.load_dataset("tips") cns.figure(150, 100) # Height x Width in pixels cns.boxplot(data=df, x="day", y="total_bill") cns.savefig("figure.svg") ``` -------------------------------- ### Verify cnsplots Installation Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/installation.md Run this Python code after installation to confirm that cnsplots is accessible and to check its version. ```python import cnsplots print(cnsplots.__version__) ``` -------------------------------- ### Quick Start: Create and Save a Boxplot Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/getting_started.md This snippet shows the basic workflow: loading data, creating a figure with specific pixel dimensions, generating a boxplot, and saving the figure to an SVG file. It requires importing cnsplots, seaborn, and matplotlib. ```python import cnsplots as cns import seaborn as sns import matplotlib.pyplot as plt # Load example data df = sns.load_dataset("tips") # Create a figure with specific dimensions (height x width in pixels) cns.figure(150, 100) # Create a boxplot cns.boxplot(data=df, x="day", y="total_bill") # Save the figure cns.savefig("my_figure.svg") ``` -------------------------------- ### Apply Temporary Settings Overrides Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/settings.md Use the `context()` method as a context manager to apply temporary overrides to specific settings. Changes are reverted upon exiting the context. ```python with cns.settings.context( palette_qual="Dark2", figure_width=200, figure_height=120, ): ... ``` -------------------------------- ### Inspect Current Settings Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/settings.md Print the current global settings object to review all active defaults. ```python import cnsplots as cns print(cns.settings) ``` -------------------------------- ### Settings Management Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/api.md Allows inspection, modification, and temporary overriding of package-wide defaults for styling and behavior. ```APIDOC ## Settings ### Description Manages package-wide defaults for styling and behavior. ### Usage - Inspect defaults: `print(cns.settings)` - Set global styling: `cns.settings.title_fontsize = 10` - Apply temporary overrides: `with cns.settings.context(palette_qual="Dark2", figure_width=200): ...` - Restore defaults: `cns.settings.reset()` ``` -------------------------------- ### Save Figures in Different Formats Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/getting_started.md Demonstrates how to save figures in various formats suitable for publication and presentations: SVG for editing, PDF for vector quality, and PNG for raster workflows. ```python # SVG - editable in Adobe Illustrator cns.savefig("figure.svg") # PDF - maintains vector quality cns.savefig("figure.pdf") # PNG for presentations or raster workflows cns.savefig("figure.png") ``` -------------------------------- ### Use Sequential Color Maps Source: https://github.com/faridrashidi/cnsplots/blob/main/README.md Apply sequential color maps for continuous data. 'gnuplot' is the default sequential option. ```python cns.figure(color_map="parula") # MATLAB-style ``` ```python cns.figure(color_map="gnuplot") # Default sequential ``` -------------------------------- ### Use Qualitative Color Palettes Source: https://github.com/faridrashidi/cnsplots/blob/main/README.md Access curated qualitative color palettes suitable for categorical data. The default 'Ecotyper1' is optimized for journals. ```python cns.figure(color_cycle="Ecotyper1") # Default, optimized for journals ``` ```python cns.figure(color_cycle="Cell") # Custom Cell-inspired journal palette ``` ```python cns.figure(color_cycle="Nature") # Nature-inspired journal palette ``` ```python cns.figure(color_cycle="Science") # Science-inspired journal palette ``` ```python cns.figure(color_cycle="Set1") # ColorBrewer Set1 ``` -------------------------------- ### Reset Settings to Package Defaults Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/settings.md Call the `reset()` method on the settings object to revert all attributes back to their original package defaults. ```python cns.settings.reset() ``` -------------------------------- ### Figure & Layout Utilities Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/api.md Provides utilities for figure and layout management, including figure creation, saving, multipanel layouts, and label/legend manipulation. ```APIDOC ## Figure & Layout Utilities ### Description Provides utilities for figure and layout management. ### Utilities - `figure` - `savefig` - `multipanel` - `add_panel_label` - `take_legend_out` ``` -------------------------------- ### Inspect and Modify cnsplots Settings Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/api.md Demonstrates how to inspect, modify, and temporarily override cnsplots package-wide settings. Use `cns.settings.reset()` to restore defaults. ```python print(cns.settings) cns.settings.title_fontsize = 10 with cns.settings.context(palette_qual="Dark2", figure_width=200): ... ``` ```python cns.settings.reset() ``` -------------------------------- ### Basic Boxplot with CNSPlots Source: https://github.com/faridrashidi/cnsplots/blob/main/README.md Create a publication-ready boxplot using CNSPlots. Load data with seaborn, set figure dimensions, and then generate the plot. ```python import cnsplots as cns import seaborn as sns # Load example data df = sns.load_dataset("tips") # Create a figure (height, width in pixels) cns.figure(height=150, width=100) # Create a publication-ready boxplot cns.boxplot(data=df, x="day", y="total_bill") # Save as vector graphic cns.savefig("figure.svg") ``` -------------------------------- ### Create a Barplot Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/getting_started.md Generates a barplot with specified dimensions, data, and mapping of columns to x, y axes, and hue. The figure size is set in pixels. ```python cns.figure(100, 80) cns.barplot(data=df, x="day", y="total_bill", hue="sex") cns.savefig("barplot.svg") ``` -------------------------------- ### Import cnsplots Library Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/api.md Import the cnsplots library for use in your Python scripts. ```python import cnsplots as cns ``` -------------------------------- ### Create a Boxplot Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/getting_started.md Generates a boxplot with specified dimensions, data, and mapping of columns to x, y axes, and hue. The figure size is set in pixels. ```python cns.figure(100, 80) cns.boxplot(data=df, x="day", y="total_bill", hue="sex") cns.savefig("boxplot.svg") ``` -------------------------------- ### Export Figure as PDF Source: https://github.com/faridrashidi/cnsplots/blob/main/README.md Save the current figure as a PDF file, which allows for editable text elements. ```python # PDF with editable text cns.savefig("figure.pdf") ``` -------------------------------- ### Export Figure as PNG Source: https://github.com/faridrashidi/cnsplots/blob/main/README.md Save the current figure as a high-resolution PNG image file. ```python # High-resolution PNG cns.savefig("figure.png") ``` -------------------------------- ### Statistical Models Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/api.md Provides access to statistical modeling functionalities including CoxModel, LogisticModel, and prerank. ```APIDOC ## Statistical Models ### Description Provides access to statistical modeling functionalities. ### Models - `CoxModel` - `LogisticModel` - `prerank` ``` -------------------------------- ### Perform Statistical Tests in Stackplots Source: https://github.com/faridrashidi/cnsplots/blob/main/README.md Generate a stackplot and conduct Fisher's exact test between specified categories. ```python # Stackplot with Fisher's exact test cns.stackplot(data=df, x="group", y="category", pairs=[("A", "B")]) ``` -------------------------------- ### Access Individual Colors Source: https://github.com/faridrashidi/cnsplots/blob/main/README.md Retrieve predefined individual colors like red and blue for custom use. ```python red = cns.RED blue = cns.BLUE ``` -------------------------------- ### Define Figure Dimensions in Pixels Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/getting_started.md Demonstrates how to set the figure's height and width in pixels using cns.figure(). Use this to control the exact canvas size before plotting. ```python # Small figure: 100 px tall and 80 px wide cns.figure(100, 80) # Larger figure: 200 px tall and 150 px wide cns.figure(200, 150) ``` -------------------------------- ### Color Palettes Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/api.md Provides access to color palettes and functions to retrieve hex colors from palettes. ```APIDOC ## Color Palettes ### Description Provides access to color palettes and related utilities. ### Functions - `palettes` - `get_hexcolors_from_apalette` ``` -------------------------------- ### Create a Scatter Plot Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/getting_started.md Generates a scatter plot with specified dimensions, data, and mapping of columns to x, y axes, and hue. The figure size is set in pixels. ```python cns.figure(100, 80) cns.scatterplot(data=df, x="total_bill", y="tip", hue="day") cns.savefig("scatter.svg") ``` -------------------------------- ### Plotting Functions: Heatmaps & Matrix Plots Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/api.md Provides access to heatmap and matrix plotting functions such as heatmapplot, dotplot, and confusionplot. ```APIDOC ## Plotting Functions: Heatmaps & Matrix Plots ### Description Provides access to heatmap and matrix plotting functions. ### Functions - `heatmapplot` - `dotplot` - `confusionplot` ``` -------------------------------- ### Perform Statistical Tests in Barplots Source: https://github.com/faridrashidi/cnsplots/blob/main/README.md Create a barplot and include Welch's t-test for a specific pair of groups. ```python # Barplot with Welch's t-test cns.barplot(data=df, x="group", y="value", pairs=[("A", "B")]) ``` -------------------------------- ### Plotting Functions: Distribution & Comparison Plots Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/api.md Provides access to various distribution and comparison plotting functions such as boxplot, violinplot, stripplot, barplot, lollipopplot, histplot, distplot, kdeplot, and ridgeplot. ```APIDOC ## Plotting Functions: Distribution & Comparison Plots ### Description Provides access to various distribution and comparison plotting functions. ### Functions - `boxplot` - `violinplot` - `stripplot` - `barplot` - `lollipopplot` - `histplot` - `distplot` - `kdeplot` - `ridgeplot` ``` -------------------------------- ### Violinplot with Custom Colors Source: https://github.com/faridrashidi/cnsplots/blob/main/README.md Create a violin plot with a custom color palette. Specify the color cycle using the 'color_cycle' argument in cns.figure. ```python # Use custom color palette cns.figure(150, 200, color_cycle="Ecotyper1") cns.violinplot(data=df, x="day", y="total_bill", hue="sex") ``` -------------------------------- ### Plotting Functions: Genomics & Statistical Plots Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/api.md Provides access to genomics and statistical plotting functions including volcanoplot, gseaplot, rocplot, and qqplot. ```APIDOC ## Plotting Functions: Genomics & Statistical Plots ### Description Provides access to genomics and statistical plotting functions. ### Functions - `volcanoplot` - `gseaplot` - `rocplot` - `qqplot` ``` -------------------------------- ### Plotting Functions: Categorical & Proportion Plots Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/api.md Provides access to categorical and proportion plotting functions including stackplot, pieplot, donutplot, vennplot, upsetplot, and sankeyplot. ```APIDOC ## Plotting Functions: Categorical & Proportion Plots ### Description Provides access to categorical and proportion plotting functions. ### Functions - `stackplot` - `pieplot` - `donutplot` - `vennplot` - `upsetplot` - `sankeyplot` ``` -------------------------------- ### Create Multi-Panel Figures Source: https://github.com/faridrashidi/cnsplots/blob/main/README.md Use the multipanel function to create a figure with multiple panels. Each panel can be defined with specific dimensions and then populated with different plot types. Automatic panel labeling (A, B, C...) is supported. ```python import cnsplots as cns mp = cns.multipanel(max_width=540) # Panel A mp.panel("A", height=150, width=150) cns.boxplot(data=df1, x="group", y="value") # Panel B mp.panel("B", height=150, width=150) cns.scatterplot(data=df2, x="x", y="y") # Continues... ``` -------------------------------- ### Create Subplots with Boxplot and Barplot Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/getting_started.md Sets up matplotlib for subplots and creates a figure containing a boxplot and a barplot side-by-side. It configures subplot dimensions and titles, then saves the combined figure. ```python cns.setup_matplotlib() fig, axes = plt.subplots(1, 2, figsize=(170 / 72, 80 / 72), dpi=144) cns.boxplot(data=df, x="day", y="total_bill", ax=axes[0]) axes[0].set_title("Box Plot") cns.barplot(data=df, x="day", y="total_bill", ax=axes[1]) axes[1].set_title("Bar Plot") plt.tight_layout() cns.savefig("subplots.svg") ``` -------------------------------- ### Export Figure as SVG Source: https://github.com/faridrashidi/cnsplots/blob/main/README.md Save the current figure as an SVG file, which is recommended for vector graphics and publication. This uses a standard matplotlib SVG backend. ```python # SVG for vector graphics (recommended) cns.savefig("figure.svg") ``` -------------------------------- ### Plotting Functions: Scatter & Regression Plots Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/api.md Provides access to scatter and regression plotting functions including scatterplot, regplot, lineplot, and slopeplot. ```APIDOC ## Plotting Functions: Scatter & Regression Plots ### Description Provides access to scatter and regression plotting functions. ### Functions - `scatterplot` - `regplot` - `lineplot` - `slopeplot` ``` -------------------------------- ### Boxplot with Statistical Comparisons Source: https://github.com/faridrashidi/cnsplots/blob/main/README.md Generate a boxplot with statistical significance annotations. Use the 'pairs' argument to specify which groups to compare using the Mann-Whitney U test. ```python # Add statistical significance annotations cns.figure(150, 150) cns.boxplot( data=df, x="day", y="total_bill", pairs=[("Thur", "Fri"), ("Sat", "Sun")], # Compare these pairs ) # Prints: P-values were determined by two-sided Mann-Whitney U test. ``` -------------------------------- ### Set Figure Dimensions in Pixels Source: https://github.com/faridrashidi/cnsplots/blob/main/README.md Specify exact pixel dimensions for the figure's canvas. This ensures precise control over the final output size. ```python cns.figure(height=150, width=100) # Final canvas size is 150px × 100px ``` -------------------------------- ### Commit Message Format Source: https://github.com/faridrashidi/cnsplots/blob/main/AGENTS.md The standard format for commit messages in this repository includes an emoji, a subject line, and an optional body. ```git 📝 Clarify pull request label rules ``` ```git 🐛 Prevent crash when input data is empty ``` ```git ♻️ Simplify plot configuration parsing ``` ```git 💥 Remove legacy export format Clients must switch to the new export path before upgrading. ``` -------------------------------- ### Color Constants Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/api.md Defines a set of predefined color constants for use in plots. ```APIDOC ## Constants ### Description Predefined color constants. ### Colors - `RED` - `BLUE` - `GREEN` - `PURPLE` - `ORANGE` - `YELLOW` - `BROWN` - `PINK` - `GRAY` - `VIOLET` - `CHOCOLATE` ``` -------------------------------- ### Perform Statistical Tests in Boxplots Source: https://github.com/faridrashidi/cnsplots/blob/main/README.md Generate a boxplot and automatically perform the Mann-Whitney U test for all specified pairs. ```python # Boxplot with Mann-Whitney U test cns.boxplot(data=df, x="group", y="value", pairs="all") ``` -------------------------------- ### Plotting Functions: Survival Analysis Plots Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/api.md Provides access to survival analysis plotting functions such as survivalplot, cumulativeincidenceplot, and forestplot. ```APIDOC ## Plotting Functions: Survival Analysis Plots ### Description Provides access to survival analysis plotting functions. ### Functions - `survivalplot` - `cumulativeincidenceplot` - `forestplot` ``` -------------------------------- ### Assign New Global Default Setting Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/settings.md Update specific attributes of the global settings object to change defaults for subsequent plotting calls. ```python cns.settings.title_fontsize = 10 cns.settings.palette_qual = "Set2" ``` -------------------------------- ### Plotting Functions: Specialized Plots Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/api.md Provides access to specialized plotting functions such as phyloplot and placeholderplot. ```APIDOC ## Plotting Functions: Specialized Plots ### Description Provides access to specialized plotting functions. ### Functions - `phyloplot` - `placeholderplot` ``` -------------------------------- ### BibTeX Citation for cnsplots Source: https://github.com/faridrashidi/cnsplots/blob/main/README.md Use this BibTeX entry to cite the cnsplots library in your research publications. ```bibtex @software{cnsplots, author = {Rashidi, Farid}, title = {cnsplots: Publication-Ready Scientific Plots}, year = {2026}, url = {https://github.com/faridrashidi/cnsplots} } ``` -------------------------------- ### Add Labels and Title to a Boxplot Source: https://github.com/faridrashidi/cnsplots/blob/main/docs/getting_started.md Customizes a boxplot by adding custom labels to the x and y axes and setting a title for the plot. The plot is generated with specified pixel dimensions. ```python cns.figure(100, 80) ax = cns.boxplot(data=df, x="day", y="total_bill") ax.set_xlabel("Day of Week") ax.set_ylabel("Total Bill ($)") ax.set_title("Tips by Day") cns.savefig("labeled_plot.svg") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.