### Install morethemes Source: https://github.com/y-sunflower/morethemes/blob/main/README.md Use pip to install the package. ```bash pip install morethemes ``` -------------------------------- ### Set up Python environment Source: https://github.com/y-sunflower/morethemes/blob/main/docs/contributing.md Installs dependencies and configures pre-commit hooks using uv. ```bash uv sync --all-groups uv pip install -e . uv run pre-commit install ``` -------------------------------- ### Set initial theme Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/custom-a-theme.md Initializes the environment with a specified theme. ```python # mkdocs: hidecode # mkdocs: hideoutput # mkdocs: render import morethemes as mt mt.set_theme("default") ``` -------------------------------- ### Clone and configure repository Source: https://github.com/y-sunflower/morethemes/blob/main/docs/contributing.md Initializes the local repository and sets the upstream remote for tracking changes. ```bash git clone https://github.com/github_user_name/morethemes.git cd morethemes git remote add upstream https://github.com/y-sunflower/morethemes.git ``` -------------------------------- ### Preview a theme Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/custom-a-theme.md Applies a theme and displays a preview of the current configuration. ```python # mkdocs: render import morethemes as mt mt.set_theme("yellowish") mt.preview_theme() ``` -------------------------------- ### mt.preview_theme() Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/reference.md Generates sample charts to visualize the current theme appearance. ```APIDOC ## mt.preview_theme() ### Description Generates various charts to allow for visual inspection of the currently applied theme. ``` -------------------------------- ### Run tests Source: https://github.com/y-sunflower/morethemes/blob/main/docs/contributing.md Executes the test suite to verify the environment or theme implementation. ```bash uv run pytest ``` -------------------------------- ### Configure Theme Colors Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/create-your-theme.md Set global color parameters for axes, figures, labels, 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 ``` -------------------------------- ### Register the theme Source: https://github.com/y-sunflower/morethemes/blob/main/docs/contributing.md Adds the new theme object 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 } ``` -------------------------------- ### Preview a Theme Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/create-your-theme.md Use the preview_theme function to visualize how a theme appears across multiple chart types. ```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() ``` -------------------------------- ### Create a new branch Source: https://github.com/y-sunflower/morethemes/blob/main/docs/contributing.md Creates a dedicated branch for the new theme development. ```bash git checkout -b sunglasses ``` -------------------------------- ### List Available Parameters Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/create-your-theme.md Retrieve all configurable Matplotlib parameters and their current values. ```python import matplotlib.pyplot as plt plt.rcParams.keys() ``` -------------------------------- ### Apply a theme with morethemes Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/create-your-theme.md Apply a predefined theme using the morethemes set_theme function. ```python import morethemes as mt mt.set_theme("darker") ``` -------------------------------- ### Commit and push changes Source: https://github.com/y-sunflower/morethemes/blob/main/docs/contributing.md Stages, commits, and pushes the theme changes to the remote repository. ```bash git add -A git commit -m "add sunglasses theme" git push ``` -------------------------------- ### Plot with default settings Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/create-your-theme.md Generate a basic plot using matplotlib defaults. ```python # mkdocs: render import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.plot([1, 2, 3]) ``` -------------------------------- ### Define a new theme Source: https://github.com/y-sunflower/morethemes/blob/main/docs/contributing.md Structure for defining a theme dictionary 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", }, } ``` -------------------------------- ### mt.set_theme() Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/reference.md 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. Themes can be stacked if reset_to_default is set to False. ### Parameters - **theme_name** (string) - Required - The name of the theme to apply. Available options: "wsj", "urban", "minimal", "ft", "nature", "economist", "retro", "yellowish", "darker", "monoblue", or "default". - **reset_to_default** (boolean) - Optional - Whether to reset to the default matplotlib theme before applying the new theme. Defaults to True. ``` -------------------------------- ### Import matplotlib pyplot Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/create-your-theme.md Standard import for matplotlib plotting functions. ```python import matplotlib.pyplot as plt ``` -------------------------------- ### Apply a theme with mt.set_theme Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/reference.md Sets the global matplotlib configuration to a specified theme. The reset_to_default parameter defaults to True to prevent theme stacking. ```python import morethemes as mt mt.set_theme("wsj") # Wall Street Journal ``` -------------------------------- ### Define Footer Styles Source: https://github.com/y-sunflower/morethemes/blob/main/overrides/partials/footer.html CSS rules for the footer container, headings, links, and decorative elements. ```css .footer.custom-footer { background-color: #1e6c5d; color: #f1f1f1; padding: 20px 20px; text-align: center; margin-top: 50px; } .footer-container { padding: 40px; max-width: 900px; margin: auto; } .footer-heading a { color: inherit; text-decoration: none; position: relative; } .footer-heading a::after { content: ""; position: absolute; width: 0; height: 2px; bottom: -5px; left: 0; background-color: rgb(144, 203, 206); transition: width 0.3s ease; } .footer-heading a:hover::after { width: 100%; } .footer-description { font-size: 1rem; line-height: 1.6; margin-bottom: 20px; } .footer-link { display: inline-block; margin-top: 10px; padding: 10px 20px; background-color: rgb(144, 203, 206); color: #1e1e2f; text-decoration: none; border-radius: 8px; font-weight: bold; font-size: 1.1rem; transition: all 0.3s ease; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); } .footer-link:hover { background-color: rgb(144, 203, 206); transform: translateY(-3px); box-shadow: 0 6px 8px rgba(0, 0, 0, 0.15); } .footer-link:active { transform: translateY(5px); } .footer-hr { margin: 25px auto 20px; border: 0; border-top: 1px solid white; width: 80%; } .footer-copy { font-size: 0.7rem; color: #ffffff; } .course-name { background-color: rgb(144, 203, 206); color: #1e1e2f; padding: 2px; } ``` -------------------------------- ### Retrieve theme rcParams with mt.get_rcparams Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/reference.md Fetches the rcParams dictionary for a specific theme without applying it globally. ```python import morethemes as mt wsj_rcparams = mt.get_rcparams("wsj") ``` -------------------------------- ### Set Theme Font Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/create-your-theme.md Apply a specific font family to the theme for consistent branding. ```python plt.rcParams['font.family'] = _set_family("Font Name") ``` -------------------------------- ### Customize Axis Spines Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/create-your-theme.md 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 ``` -------------------------------- ### Apply custom rcParams to matplotlib Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/reference.md Updates the current matplotlib configuration using a dictionary 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) ``` -------------------------------- ### mt.get_rcparams() Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/reference.md 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://github.com/y-sunflower/morethemes/blob/main/docs/guide/create-your-theme.md 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 matplotlib themes Source: https://github.com/y-sunflower/morethemes/blob/main/README.md Apply specific visual themes to matplotlib plots using the set_theme function. ```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") ``` -------------------------------- ### Define Color Cycles Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/create-your-theme.md Use cycler to define a custom sequence of colors for chart elements like lines and bars. ```python from cycler import cycler plt.rcParams["axes.prop_cycle"] = cycler( "color", ["#FED789", "#A4BED5", "#72874E", "#023743", "#476F84", "#453947"] ) ``` -------------------------------- ### Modify line width via rcParams Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/create-your-theme.md Update the global line width parameter to 5. ```python # mkdocs: render import matplotlib.pyplot as plt plt.rcParams["lines.linewidth"] = 5 fig, ax = plt.subplots() ax.plot([1, 2, 3]) ``` -------------------------------- ### Override theme parameters Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/custom-a-theme.md Modifies matplotlib rcParams to customize specific theme attributes like background colors. ```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() ``` -------------------------------- ### Modify text color via rcParams Source: https://github.com/y-sunflower/morethemes/blob/main/docs/guide/create-your-theme.md Update the global text color parameter 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) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.