-
Notifications
You must be signed in to change notification settings - Fork 0
13 create a gallery #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
5632ffe
Fixed tutorial 1 and 2
max-models 283057c
set widths to 17cm
max-models 684029d
Removed .py tutorials
max-models b2adfdb
Added pre-commit config
max-models 1efc9af
Converted tutorials to ipynb
max-models 64197d6
Adde pre-commit to pyproject.toml
max-models f384842
Cleaned out tutorials
max-models 8961d99
added tutorial 5 and 6
max-models 662dc7c
Added docs
max-models 6065159
moved docs to new workflow
max-models 61f6b5d
Commented out compile_pdf
max-models d9949fb
Formatting
max-models 17b5d76
formatting
max-models ded5c6b
Added deployment
max-models d7a04fb
fix
max-models caf4b77
Try using the gh template
max-models 9683f5e
bugfix
max-models da6bfdb
build on push to 13-create-a-gallery
max-models b38af38
removed temp branch from docs.yml
max-models File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| name: Deploy docs to GitHub Pages | ||
|
|
||
| on: | ||
| push: | ||
| branches: ["devel", "main"] # TODO: Set to main only after release | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pages: write | ||
| id-token: write | ||
|
|
||
| concurrency: | ||
| group: "pages" | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| build-and-deploy: | ||
| runs-on: ubuntu-latest | ||
| environment: | ||
| name: github-pages | ||
| url: ${{ steps.deployment.outputs.page_url }} | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install pandoc | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y pandoc | ||
|
|
||
| - name: Install Python dependencies | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install ".[docs]" | ||
|
|
||
| - name: Build Sphinx docs | ||
| run: | | ||
| cd docs | ||
| make html | ||
|
|
||
| - name: Setup Pages | ||
| uses: actions/configure-pages@v5 | ||
|
|
||
| - name: Upload built docs | ||
| uses: actions/upload-pages-artifact@v3 | ||
| with: | ||
| path: docs/build/html/ | ||
|
|
||
| - name: Deploy to GitHub Pages | ||
| id: deployment | ||
| uses: actions/deploy-pages@v4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| repos: | ||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v5.0.0 # Use the latest stable version | ||
| hooks: | ||
| - id: check-added-large-files # Prevent giant files from being committed. | ||
| args: ["--maxkb=1000"] | ||
| - id: check-merge-conflict # Check for files that contain merge conflict strings. | ||
| - id: check-toml # Attempts to load all TOML files to verify syntax. | ||
| - id: check-yaml # Attempts to load all yaml files to verify syntax. | ||
| args: ["--unsafe"] | ||
|
|
||
| - repo: https://github.com/kynan/nbstripout | ||
| rev: 0.8.1 | ||
| hooks: | ||
| - id: nbstripout # remove jupyter notebook cell output |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| # Minimal makefile for Sphinx documentation | ||
| # | ||
|
|
||
| # You can set these variables from the command line, and also | ||
| # from the environment for the first two. | ||
| SPHINXOPTS ?= | ||
| SPHINXBUILD ?= sphinx-build | ||
| SOURCEDIR = source | ||
| BUILDDIR = build | ||
|
|
||
| # Put it first so that "make" without argument is like "make help". | ||
| help: | ||
| @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
|
||
| .PHONY: help Makefile | ||
|
|
||
| # Catch-all target: route all unknown targets to Sphinx using the new | ||
| # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
| %: Makefile | ||
| @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| @ECHO OFF | ||
|
|
||
| pushd %~dp0 | ||
|
|
||
| REM Command file for Sphinx documentation | ||
|
|
||
| if "%SPHINXBUILD%" == "" ( | ||
| set SPHINXBUILD=sphinx-build | ||
| ) | ||
| set SOURCEDIR=source | ||
| set BUILDDIR=build | ||
|
|
||
| %SPHINXBUILD% >NUL 2>NUL | ||
| if errorlevel 9009 ( | ||
| echo. | ||
| echo.The 'sphinx-build' command was not found. Make sure you have Sphinx | ||
| echo.installed, then set the SPHINXBUILD environment variable to point | ||
| echo.to the full path of the 'sphinx-build' executable. Alternatively you | ||
| echo.may add the Sphinx directory to PATH. | ||
| echo. | ||
| echo.If you don't have Sphinx installed, grab it from | ||
| echo.https://www.sphinx-doc.org/ | ||
| exit /b 1 | ||
| ) | ||
|
|
||
| if "%1" == "" goto help | ||
|
|
||
| %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
| goto end | ||
|
|
||
| :help | ||
| %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% | ||
|
|
||
| :end | ||
| popd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Configuration file for the Sphinx documentation builder. | ||
| # | ||
| # For the full list of built-in configuration values, see the documentation: | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
|
||
| import os | ||
| import shutil | ||
|
|
||
|
|
||
| def copy_tutorials(app): | ||
| src = os.path.abspath("../tutorials") | ||
| dst = os.path.abspath("source/tutorials") | ||
|
|
||
| # Remove existing target directory if it exists | ||
| if os.path.exists(dst): | ||
| shutil.rmtree(dst) | ||
|
|
||
| shutil.copytree(src, dst) | ||
|
|
||
|
|
||
| def setup(app): | ||
| app.connect("builder-inited", copy_tutorials) | ||
|
|
||
|
|
||
| # -- Project information ----------------------------------------------------- | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
|
||
| project = "maxplotlib" | ||
| copyright = "2025, Max Lindqvist" | ||
| author = "Max Lindqvist" | ||
|
|
||
| # -- General configuration --------------------------------------------------- | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
|
||
| extensions = [ | ||
| "nbsphinx", | ||
| "sphinx.ext.mathjax", | ||
| "sphinx.ext.autodoc", | ||
| ] | ||
|
|
||
| templates_path = ["_templates"] | ||
| exclude_patterns = [] | ||
|
|
||
|
|
||
| # -- Options for HTML output ------------------------------------------------- | ||
| # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
|
||
| html_theme = "sphinx_rtd_theme" | ||
| html_static_path = ["_static"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| .. maxplotlib documentation master file, created by | ||
| sphinx-quickstart on Sun Jun 22 11:14:00 2025. | ||
| You can adapt this file completely to your liking, but it should at least | ||
| contain the root `toctree` directive. | ||
|
|
||
| maxplotlib documentation | ||
| ======================== | ||
|
|
||
| Add your content using ``reStructuredText`` syntax. See the | ||
| `reStructuredText <https://www.sphinx-doc.org/en/master/usage/restructuredtext/index.html>`_ | ||
| documentation for details. | ||
|
|
||
|
|
||
| .. toctree:: | ||
| :maxdepth: 2 | ||
| :caption: Tutorials: | ||
|
|
||
| tutorials/tutorial_01 | ||
| tutorials/tutorial_02 | ||
| tutorials/tutorial_03 | ||
| tutorials/tutorial_04 | ||
| tutorials/tutorial_05 | ||
| tutorials/tutorial_06 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| { | ||
| "cells": [ | ||
| { | ||
| "cell_type": "markdown", | ||
| "id": "0", | ||
| "metadata": {}, | ||
| "source": [ | ||
| "\n", | ||
| "# Tutorial 1\n" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "1", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "import maxplotlib.canvas.canvas as canvas\n", | ||
| "\n", | ||
| "%load_ext autoreload\n", | ||
| "%autoreload 2" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "2", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "c = canvas.Canvas(width=\"17cm\", ratio=0.5, fontsize=12)\n", | ||
| "sp = c.add_subplot(\n", | ||
| " grid=True, xlabel=\"(x - 10) * 0.1\", ylabel=\"10y\", yscale=10, xshift=-10, xscale=0.1\n", | ||
| ")\n", | ||
| "sp.add_line([0, 1, 2, 3], [0, 1, 4, 9], label=\"Line 1\")\n", | ||
| "sp.add_line([0, 1, 2, 3], [0, 2, 3, 4], linestyle=\"dashed\", color=\"red\", label=\"Line 2\")\n", | ||
| "c.plot()\n", | ||
| "c.savefig(filename=\"tutorial_01_01.pdf\")" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "3", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "c = canvas.Canvas(width=\"17cm\", ncols=2, nrows=2, ratio=0.5)\n", | ||
| "sp = c.add_subplot(grid=True)\n", | ||
| "c.add_subplot(row=1)\n", | ||
| "sp2 = c.add_subplot(row=1, legend=False)\n", | ||
| "sp.add_line([0, 1, 2, 3], [0, 1, 4, 9], label=\"Line 1\")\n", | ||
| "sp2.add_line(\n", | ||
| " [0, 1, 2, 3], [0, 2, 3, 4], linestyle=\"dashed\", color=\"red\", label=\"Line 2\"\n", | ||
| ")\n", | ||
| "c.plot(backend=\"matplotlib\")\n", | ||
| "c.plot(backend=\"plotly\")\n", | ||
| "c.savefig(filename=\"tutorial_01_02.pdf\")" | ||
| ] | ||
| }, | ||
| { | ||
| "cell_type": "code", | ||
| "execution_count": null, | ||
| "id": "4", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ | ||
| "# Test with plotly backend\n", | ||
| "c = canvas.Canvas(width=\"17cm\", ratio=0.5)\n", | ||
| "sp = c.add_subplot(\n", | ||
| " grid=True, xlabel=\"x (mm)\", ylabel=\"10y\", yscale=10, xshift=-10, xscale=0.1\n", | ||
| ")\n", | ||
| "sp.add_line([0, 1, 2, 3], [0, 1, 4, 9], label=\"Line 1\", linestyle=\"-.\")\n", | ||
| "sp.add_line([0, 1, 2, 3], [0, 2, 3, 4], linestyle=\"dashed\", color=\"red\", label=\"Line 2\")\n", | ||
| "c.plot(backend=\"matplotlib\")\n", | ||
| "c.plot(backend=\"plotly\")\n", | ||
| "c.savefig(filename=\"tutorial_01_03.pdf\")" | ||
| ] | ||
| } | ||
| ], | ||
| "metadata": { | ||
| "kernelspec": { | ||
| "display_name": "env_maxplotlib", | ||
| "language": "python", | ||
| "name": "python3" | ||
| }, | ||
| "language_info": { | ||
| "codemirror_mode": { | ||
| "name": "ipython", | ||
| "version": 3 | ||
| }, | ||
| "file_extension": ".py", | ||
| "mimetype": "text/x-python", | ||
| "name": "python", | ||
| "nbconvert_exporter": "python", | ||
| "pygments_lexer": "ipython3", | ||
| "version": "3.13.3" | ||
| } | ||
| }, | ||
| "nbformat": 4, | ||
| "nbformat_minor": 5 | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.