### Setup Python Environment Source: https://y-sunflower.github.io/morethemes/contributing Installs dependencies and pre-commit hooks using uv. ```bash uv sync --all-groups uv pip install -e . uv run pre-commit install ``` -------------------------------- ### Install morethemes Source: https://y-sunflower.github.io/morethemes Install the library using pip. ```bash pip install morethemes ``` -------------------------------- ### Clone and Configure Repository Source: https://y-sunflower.github.io/morethemes/contributing Initializes the local development environment by cloning the repository and setting up the upstream remote. ```bash git clone https://github.com/github_user_name/morethemes.git cd morethemes git remote add upstream https://github.com/y-sunflower/morethemes.git ``` -------------------------------- ### Apply and preview a theme Source: https://y-sunflower.github.io/morethemes/guide/custom-a-theme Initializes a theme and displays a preview using the morethemes library. ```python # mkdocs: render import morethemes as mt mt.set_theme("yellowish") mt.preview_theme() ``` -------------------------------- ### Preview a theme with morethemes Source: https://y-sunflower.github.io/morethemes/guide/create-your-theme Use the preview_theme function to generate sample charts and visualize the current theme configuration. ```python # mkdocs: render import matplotlib.pyplot as plt import morethemes as mt # Example of a (ugly) theme. Change it with your own rcParams. plt.rcParams["figure.facecolor"] = "#282828" plt.rcParams["axes.edgecolor"] = "#eeeeee" plt.rcParams["xtick.color"] = "#eeeeee" plt.rcParams["axes.spines.right"] = False mt.preview_theme() ``` -------------------------------- ### mt.preview_theme() Source: https://y-sunflower.github.io/morethemes/guide/reference Generates sample charts to visualize the current theme's appearance. ```APIDOC ## mt.preview_theme() ### Description Creates various charts to allow for visual inspection of the currently active theme. ``` -------------------------------- ### Run Tests Source: https://y-sunflower.github.io/morethemes/contributing Executes the test suite to verify the environment or theme implementation. ```bash uv run pytest ``` -------------------------------- ### Register New Theme Source: https://y-sunflower.github.io/morethemes/contributing Adds the new theme to the ALL_THEMES dictionary in morethemes/morethemes/themes.py. ```python ALL_THEMES = { "darker": darker_theme, "lighter": lighter_theme, "sunglasses": sunglasses_theme, # add your theme here } ``` -------------------------------- ### Apply a theme with morethemes Source: https://y-sunflower.github.io/morethemes/guide/create-your-theme Uses the morethemes library to apply a predefined theme configuration. ```python import morethemes as mt mt.set_theme("darker") ``` -------------------------------- ### Create Feature Branch Source: https://y-sunflower.github.io/morethemes/contributing Creates a new branch for the theme development. ```bash git checkout -b sunglasses ``` -------------------------------- ### Commit and Push Changes Source: https://y-sunflower.github.io/morethemes/contributing Stages, commits, and pushes the theme changes to the remote repository. ```bash git add -A git commit -m "add sunglasses theme" git push ``` -------------------------------- ### List all available Matplotlib parameters Source: https://y-sunflower.github.io/morethemes/guide/create-your-theme Retrieve all configurable rcParams keys and their default values. ```python import matplotlib.pyplot as plt plt.rcParams.keys() ``` -------------------------------- ### Define New Theme Source: https://y-sunflower.github.io/morethemes/contributing Defines the theme dictionary structure in morethemes/themes.py. ```python sunglasses_theme = { "name": "sunglasses", # the name of your theme "description": "A description of the theme", "theme": { # all arguments passed to plt.rcParams "axes.facecolor": "#232323", "figure.facecolor": "#282828", }, } ``` -------------------------------- ### Configure color parameters Source: https://y-sunflower.github.io/morethemes/guide/create-your-theme Set specific color parameters for axes, labels, ticks, and text elements. ```python plt.rcParams["axes.facecolor"] = "black" # Axes color plt.rcParams["figure.facecolor"] = "black" # Figure color plt.rcParams["axes.labelcolor"] = "grey" # Label color plt.rcParams["axes.edgecolor"] = "grey" # Spines color plt.rcParams["xtick.color"] = "grey" # x tick color plt.rcParams["ytick.color"] = "grey" # y tick color plt.rcParams["text.color"] = "white" # Text color ``` -------------------------------- ### mt.set_theme(theme_name, reset_to_default=True) Source: https://y-sunflower.github.io/morethemes/guide/reference Applies a specified theme to the global matplotlib configuration. ```APIDOC ## mt.set_theme(theme_name, reset_to_default=True) ### Description Applies a theme to the global matplotlib configuration. Available themes include: "wsj", "urban", "minimal", "ft", "nature", "economist", "retro", "yellowish", "darker", "monoblue". ### Parameters - **theme_name** (string) - Required - The name of the theme to apply. - **reset_to_default** (boolean) - Optional - Whether to reset to the default matplotlib theme before applying. Defaults to True. ``` -------------------------------- ### Import matplotlib pyplot Source: https://y-sunflower.github.io/morethemes/guide/create-your-theme Initial import required to access matplotlib plotting functions. ```python import matplotlib.pyplot as plt ``` -------------------------------- ### Apply a theme with mt.set_theme Source: https://y-sunflower.github.io/morethemes/guide/reference Applies a specified theme to the global Matplotlib configuration. The reset_to_default parameter defaults to True to prevent theme stacking. ```python import morethemes as mt mt.set_theme("wsj") # Wall Street Journal ``` -------------------------------- ### Retrieve theme rcParams with mt.get_rcparams Source: https://y-sunflower.github.io/morethemes/guide/reference Fetches the rcParams dictionary for a specific theme without applying it globally. ```python import morethemes as mt wsj_rcparams = mt.get_rcparams("wsj") ``` -------------------------------- ### Plot with default line width Source: https://y-sunflower.github.io/morethemes/guide/create-your-theme Demonstrates a standard plot using matplotlib's default line width of 1. ```python # mkdocs: render import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.plot([1, 2, 3]) ``` -------------------------------- ### Set a custom font family Source: https://y-sunflower.github.io/morethemes/guide/create-your-theme Apply a specific font family to the theme using the _set_family helper. ```python plt.rcParams['font.family'] = _set_family("Font Name") ``` -------------------------------- ### Customize axis spines Source: https://y-sunflower.github.io/morethemes/guide/create-your-theme Control the visibility, color, and width of the spines surrounding the axes. ```python plt.rcParams["axes.spines.top"] = False # Remove top spine plt.rcParams["axes.spines.bottom"] = False # Remove bottom spine plt.rcParams["axes.spines.right"] = False # Remove right spine plt.rcParams["axes.spines.left"] = False # Remove left spine plt.rcParams["axes.edgecolor"] = "#eeeeee" # Spine color plt.rcParams["axes.linewidth"] = 1.5 # Spine width ``` -------------------------------- ### mt.get_rcparams(theme_name) Source: https://y-sunflower.github.io/morethemes/guide/reference Retrieves the rcParams dictionary for a specific theme. ```APIDOC ## mt.get_rcparams(theme_name) ### Description Returns a dictionary of rcParams for the specified theme, which can be used to update matplotlib configurations manually. ### Parameters - **theme_name** (string) - Required - The name of the theme to retrieve parameters for. ``` -------------------------------- ### Define a custom Matplotlib theme Source: https://y-sunflower.github.io/morethemes/guide/create-your-theme Set custom rcParams to define the visual style of Matplotlib figures. ```python import matplotlib.pyplot as plt # Example of a theme. Change it with your own rcParams. plt.rcParams["figure.facecolor"] = "#282828" plt.rcParams["axes.edgecolor"] = "#eeeeee" plt.rcParams["xtick.color"] = "#eeeeee" plt.rcParams["axes.spines.right"] = False ``` -------------------------------- ### Apply custom rcParams to Matplotlib Source: https://y-sunflower.github.io/morethemes/guide/reference Updates the current Matplotlib configuration using a dictionary of rcParams retrieved from a theme. ```python import morethemes as mt import matplotlib.pyplot as plt wsj_rcparams = mt.get_rcparams("wsj") plt.rcParams.update(wsj_rcparams) ``` -------------------------------- ### Define a custom color cycle Source: https://y-sunflower.github.io/morethemes/guide/create-your-theme Use the cycler module to define a custom color palette for chart elements. ```python from cycler import cycler plt.rcParams["axes.prop_cycle"] = cycler( "color", ["#FED789", "#A4BED5", "#72874E", "#023743", "#476F84", "#453947"] ) ``` -------------------------------- ### Apply matplotlib themes Source: https://y-sunflower.github.io/morethemes Use the set_theme function to apply a specific theme to your matplotlib plots. ```python import morethemes as mt mt.set_theme("wsj") ``` ```python import morethemes as mt mt.set_theme("urban") ``` ```python import morethemes as mt mt.set_theme("minimal") ``` ```python import morethemes as mt mt.set_theme("ft") ``` ```python import morethemes as mt mt.set_theme("nature") ``` ```python import morethemes as mt mt.set_theme("economist") ``` ```python import morethemes as mt mt.set_theme("greenwave") ``` ```python import morethemes as mt mt.set_theme("lumen") ``` ```python import morethemes as mt mt.set_theme("ebonis") ``` ```python import morethemes as mt mt.set_theme("lighter") ``` ```python import morethemes as mt mt.set_theme("vscode-dark") ``` ```python import morethemes as mt mt.set_theme("nord") ``` ```python import morethemes as mt mt.set_theme("retro") ``` ```python import morethemes as mt mt.set_theme("darker") ``` ```python import morethemes as mt mt.set_theme("yellowish") ``` ```python import morethemes as mt mt.set_theme("monoblue") ``` -------------------------------- ### Modify default line width Source: https://y-sunflower.github.io/morethemes/guide/create-your-theme Updates the global rcParams to set the default line width to 5. ```python # mkdocs: render import matplotlib.pyplot as plt plt.rcParams["lines.linewidth"] = 5 fig, ax = plt.subplots() ax.plot([1, 2, 3]) ``` -------------------------------- ### Modify default text color Source: https://y-sunflower.github.io/morethemes/guide/create-your-theme Updates the global rcParams to change the default text color to red. ```python # mkdocs: render import matplotlib.pyplot as plt plt.rcParams["text.color"] = "red" fig, ax = plt.subplots() ax.text(x=0.3, y=0.5, s="Hello world", size=20) ``` -------------------------------- ### Override theme background colors Source: https://y-sunflower.github.io/morethemes/guide/custom-a-theme Modifies specific matplotlib rcParams to change the background color of a theme after it has been set. ```python # mkdocs: render import morethemes as mt import matplotlib.pyplot as plt mt.set_theme("yellowish") plt.rcParams["figure.facecolor"] = "skyblue" plt.rcParams["axes.facecolor"] = "skyblue" mt.preview_theme() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.