diff --git a/.gitignore b/.gitignore index 652b158..66959f8 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,7 @@ docs/auto_examples/ docs/.jupyter_cache/ docs/sg_execution_times.rst .ipynb_checkpoints +great-docs/ # PyBuilder target/ diff --git a/AUTHORS.md b/AUTHORS.md new file mode 100644 index 0000000..dd62630 --- /dev/null +++ b/AUTHORS.md @@ -0,0 +1,9 @@ +# Credits + +## Development Lead + +- Paul M. Hobson + +## Contributors + +- Pierre Haessig diff --git a/AUTHORS.rst b/AUTHORS.rst deleted file mode 100644 index 929fb67..0000000 --- a/AUTHORS.rst +++ /dev/null @@ -1,13 +0,0 @@ -======= -Credits -======= - -Development Lead ----------------- - -* Paul M. Hobson - -Contributors ------------- - -* Pierre Haessig diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..a7da0db --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,114 @@ +# Contributing + +Contributions are welcome, and they are greatly appreciated! Every +little bit helps, and credit will always be given. + +You can contribute in many ways: + +## Types of Contributions + +### Report Bugs + +Report bugs at . + +If you are reporting a bug, please include: + +- Your operating system name and version. +- Any details about your local setup that might be helpful in troubleshooting. +- Detailed steps to reproduce the bug. + +### Fix Bugs + +Look through the GitHub issues for bugs. Anything tagged with "bug" +and "help wanted" is open to whoever wants to implement it. + +### Implement Features + +Look through the GitHub issues for features. Anything tagged with "enhancement" +and "help wanted" is open to whoever wants to implement it. + +### Write Documentation + +mpl-probscale could always use more documentation, whether as part of the +official mpl-probscale docs, in docstrings, or even on the web in blog posts, +articles, and such. + +### Submit Feedback + +The best way to send feedback is to file an issue at +. + +If you are proposing a feature: + +- Explain in detail how it would work. +- Keep the scope as narrow as possible, to make it easier to implement. +- Remember that this is a volunteer-driven project, and that contributions + are welcome :) + +## Get Started! + +Ready to contribute? Here's how to set up `probscale` for local development. + +1. Fork the `probscale` repo on GitHub. +2. Clone your fork locally: + + ```console + $ git clone git@github.com:your_name_here/probscale.git + ``` + +3. Install your local copy into a virtual environment with + [uv](https://docs.astral.sh/uv/): + + ```console + $ cd probscale/ + $ uv sync + ``` + +4. Create a branch for local development: + + ```console + $ git checkout -b name-of-your-bugfix-or-feature + ``` + + Now you can make your changes locally. + +5. When you're done making changes, check that your changes pass the tests: + + ```console + $ uv run pytest --mpl + ``` + +6. Commit your changes and push your branch to GitHub: + + ```console + $ git add + $ git commit -m "Your detailed description of your changes." + $ git push origin name-of-your-bugfix-or-feature + ``` + +7. Submit a pull request through the GitHub website. + +Matplotlib has good info on working with [source code] using [git and GitHub]. + +[source code]: https://matplotlib.org/devdocs/devel/coding_guide.html +[git and GitHub]: https://matplotlib.org/devdocs/devel/development_workflow.html + +## Pull Request Guidelines + +Before you submit a pull request, check that it meets these guidelines: + +1. The pull request should include tests. +2. If the pull request adds functionality, the docs should be updated. Put + your new functionality into a function with a docstring, and add the + feature to the list in the README. +3. The pull request should work for Python 3.11 and higher. Check the + GitHub Actions results and make sure that the tests pass for all + supported Python versions. + +## Tips + +To run a subset of tests: + +```console +$ uv run pytest probscale/tests/test_probscale.py +``` diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst deleted file mode 100644 index 7e94ba1..0000000 --- a/CONTRIBUTING.rst +++ /dev/null @@ -1,120 +0,0 @@ -.. highlight:: shell - -============ -Contributing -============ - -Contributions are welcome, and they are greatly appreciated! Every -little bit helps, and credit will always be given. - -You can contribute in many ways: - -Types of Contributions ----------------------- - -Report Bugs -~~~~~~~~~~~ - -Report bugs at https://github.com/matplotlib/mpl-probscale/issues. - -If you are reporting a bug, please include: - -* Your operating system name and version. -* Any details about your local setup that might be helpful in troubleshooting. -* Detailed steps to reproduce the bug. - -Fix Bugs -~~~~~~~~ - -Look through the GitHub issues for bugs. Anything tagged with "bug" -and "help wanted" is open to whoever wants to implement it. - -Implement Features -~~~~~~~~~~~~~~~~~~ - -Look through the GitHub issues for features. Anything tagged with "enhancement" -and "help wanted" is open to whoever wants to implement it. - -Write Documentation -~~~~~~~~~~~~~~~~~~~ - -mpl-probscale could always use more documentation, whether as part of the -official mpl-probscale docs, in docstrings, or even on the web in blog posts, -articles, and such. - -Submit Feedback -~~~~~~~~~~~~~~~ - -The best way to send feedback is to file an issue at https://github.com/matplotlib/mpl-probscale/issues. - -If you are proposing a feature: - -* Explain in detail how it would work. -* Keep the scope as narrow as possible, to make it easier to implement. -* Remember that this is a volunteer-driven project, and that contributions - are welcome :) - -Get Started! ------------- - -Ready to contribute? Here's how to set up `probscale` for local development. - -1. Fork the `probscale` repo on GitHub. -2. Clone your fork locally:: - - $ git clone git@github.com:your_name_here/probscale.git - -3. Install your local copy into a conda environment. Assuming you have conda installed, this is how you set up your fork for local development:: - - $ conda config --add channels conda-forge - $ conda create --name=probscale python=3.5 numpy matplotlib pytest pytest-cov pytest-pep8 pytest-mpl - $ cd probscale/ - $ pip install -e . - -4. Create a branch for local development:: - - $ git checkout -b name-of-your-bugfix-or-feature - - Now you can make your changes locally. - -5. When you're done making changes, check that your changes pass flake8 and the tests, including testing other Python versions with tox:: - - $ python -m pytest --mpl --pep8 --cov - -6. Commit your changes and push your branch to GitHub:: - - $ git add - $ git commit -m "Your detailed description of your changes." - $ git push origin name-of-your-bugfix-or-feature - -7. Submit a pull request through the GitHub website. - -Matplotlib has good info on working with `source code`_ using `git and GitHub`_. - -.. _source code: http://matplotlib.org/devel/coding_guide.html` -.. _git and GitHub: http://matplotlib.org/devel/gitwash/development_workflow.html - -Pull Request Guidelines ------------------------ - -Before you submit a pull request, check that it meets these guidelines: - -1. The pull request should include tests. -2. If the pull request adds functionality, the docs should be updated. Put - your new functionality into a function with a docstring, and add the - feature to the list in README.rst. -3. The pull request should work for Python 3.11 and higher. Check - https://travis-ci.org/matplotlib/mpl-probscale/pull_requests - and make sure that the tests pass for all supported Python versions. - -Tips ----- - -To run a subset of tests:: - -$ py.test tests.test_probscale - - -After this, hitting ctrl+b in either text editor will run the test suite. - -.. _build: https://atom.io/packages/build diff --git a/README.md b/README.md index 062382a..5053c98 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,8 @@ pip install -e . Simply importing `probscale` lets you use probability scales in your matplotlib figures: ```python +from pathlib import Path + from matplotlib import pyplot from scipy import stats import probscale # nothing else needed @@ -64,7 +66,10 @@ fig, axes = pyplot.subplots(nrows=N, figsize=(9, N - 1), constrained_layout=True for scale, ax in zip(scales, axes.flat): ax.set_xscale(**scale["scale"]) ax.text(0.0, 0.1, scale["label"] + " →", transform=ax.transAxes) - ax.set_xlim(left=0.5, right=99.5) + + factor = 100 if scale["scale"]["value"] == "logit" else 1 + ax.set_xlim(left=0.5 / factor, right=99.5 / factor) + ax.set_yticks([]) ax.spines.left.set_visible(False) ax.spines.right.set_visible(False) diff --git a/docs/api.md b/docs/api.md new file mode 100644 index 0000000..b21bafd --- /dev/null +++ b/docs/api.md @@ -0,0 +1,11 @@ +# API Reference + +```{toctree} +:maxdepth: 2 + +api/viz.rst +api/probscale.rst +api/formatters.rst +api/transforms.rst +api/validate.rst +``` diff --git a/docs/api.rst b/docs/api.rst deleted file mode 100644 index 6ecfa49..0000000 --- a/docs/api.rst +++ /dev/null @@ -1,11 +0,0 @@ -API and Source Reference ------------------------- - -.. toctree:: - :maxdepth: 2 - - api/viz.rst - api/probscale.rst - api/formatters.rst - api/transforms.rst - api/validate.rst diff --git a/docs/authors.md b/docs/authors.md new file mode 100644 index 0000000..73a1374 --- /dev/null +++ b/docs/authors.md @@ -0,0 +1,2 @@ +```{include} ../AUTHORS.md +``` diff --git a/docs/authors.rst b/docs/authors.rst deleted file mode 100644 index e122f91..0000000 --- a/docs/authors.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../AUTHORS.rst diff --git a/docs/conf.py b/docs/conf.py index 90985e3..09596e3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -83,6 +83,9 @@ # -- myst-nb (tutorial notebooks) -------------------------------------------- +myst_enable_extensions = ["colon_fence", "deflist", "dollarmath"] +myst_heading_anchors = 3 + nb_execution_mode = "auto" nb_execution_timeout = 600 nb_execution_raise_on_error = True diff --git a/docs/contributing.md b/docs/contributing.md new file mode 100644 index 0000000..78caf34 --- /dev/null +++ b/docs/contributing.md @@ -0,0 +1,2 @@ +```{include} ../CONTRIBUTING.md +``` diff --git a/docs/contributing.rst b/docs/contributing.rst deleted file mode 100644 index e582053..0000000 --- a/docs/contributing.rst +++ /dev/null @@ -1 +0,0 @@ -.. include:: ../CONTRIBUTING.rst diff --git a/docs/examples/example.py b/docs/examples/example.py index 6f047da..1d8358a 100644 --- a/docs/examples/example.py +++ b/docs/examples/example.py @@ -37,7 +37,10 @@ for scale, ax in zip(scales, axes.flat): ax.set_xscale(**scale["scale"]) ax.text(0.0, 0.1, scale["label"] + " →", transform=ax.transAxes) - ax.set_xlim(left=0.5, right=99.5) + + factor = 100 if scale["scale"]["value"] == "logit" else 1 + ax.set_xlim(left=0.5 / factor, right=99.5 / factor) + ax.set_yticks([]) ax.spines.left.set_visible(False) ax.spines.right.set_visible(False) diff --git a/docs/img/example.png b/docs/img/example.png index 3d55b2e..c6be379 100644 Binary files a/docs/img/example.png and b/docs/img/example.png differ diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 0000000..acc14ec --- /dev/null +++ b/docs/index.md @@ -0,0 +1,34 @@ +```{include} ../README.md +:relative-docs: . +:relative-images: +``` + +## Documentation + +```{toctree} +:maxdepth: 2 +:caption: Contents + +installation +tutorial/getting_started.ipynb +tutorial/closer_look_at_viz.ipynb +tutorial/closer_look_at_plot_pos.ipynb +auto_examples/index +altair/index +api +``` + +```{toctree} +:maxdepth: 1 +:hidden: +:caption: Project + +authors +contributing +``` + +## Indices and tables + +- {ref}`genindex` +- {ref}`modindex` +- {ref}`search` diff --git a/docs/index.rst b/docs/index.rst deleted file mode 100644 index 1e21571..0000000 --- a/docs/index.rst +++ /dev/null @@ -1,92 +0,0 @@ -.. probscale documentation master file. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -mpl-probscale: Real probability scales for matplotlib -===================================================== - -.. image:: https://github.com/matplotlib/mpl-probscale/actions/workflows/python-runtests-all.yml/badge.svg - :target: https://github.com/matplotlib/mpl-probscale/actions/workflows/python-runtests-all.yml - -.. image:: https://github.com/matplotlib/mpl-probscale/actions/workflows/ruff_ty.yml/badge.svg - :target: https://github.com/matplotlib/mpl-probscale/actions/workflows/ruff_ty.yml - -Installation ------------- - -Install the latest release with ``pip install probscale`` (also available on -conda-forge as ``mpl-probscale``). See the :doc:`installation` page for -details. - -Quickstart ----------- - -Simply importing ``probscale`` lets you use probability scales in your -matplotlib figures: - -.. code-block:: python - - import matplotlib.pyplot as plt - import probscale - - fig, ax = plt.subplots(figsize=(8, 4)) - ax.set_xlim(0.5, 99.5) - ax.set_xscale("prob") - ax.set_ylim(1e-2, 1e2) - ax.set_yscale("log") - -.. image:: /img/example.png - -Tutorials ---------- - -.. toctree:: - :maxdepth: 2 - - tutorial/getting_started.ipynb - tutorial/closer_look_at_viz.ipynb - tutorial/closer_look_at_plot_pos.ipynb - -Examples --------- - -.. toctree:: - :maxdepth: 2 - - auto_examples/index - altair/index - -API Reference -------------- - -.. toctree:: - :maxdepth: 2 - - api.rst - -Testing -------- - -Run the test suite (including the image comparison tests) from the repository -root: - -.. code-block:: console - - $ uv run pytest --mpl - -Indices and tables ------------------- - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` - -.. toctree:: - :maxdepth: 1 - :hidden: - :caption: Project - - readme.md - installation.rst - authors.rst - contributing.rst \ No newline at end of file diff --git a/docs/installation.md b/docs/installation.md new file mode 100644 index 0000000..3247e40 --- /dev/null +++ b/docs/installation.md @@ -0,0 +1,42 @@ +# Installation + +## Stable release + +To install mpl-probscale, run this command in your terminal: + +```console +$ pip install probscale +``` + +This is the preferred method to install mpl-probscale, as it will always +install the most recent stable release. + +If you don't have [pip] installed, this [Python installation guide] can guide +you through the process. + +## From sources + +The sources for mpl-probscale can be downloaded from the [GitHub repo]. + +You can either clone the public repository: + +```console +$ git clone https://github.com/matplotlib/mpl-probscale +``` + +Or download the [tarball]: + +```console +$ curl -OL https://github.com/matplotlib/mpl-probscale/tarball/main +``` + +Once you have a copy of the source, you can install it with: + +```console +$ pip install . +``` + +[pip]: https://pip.pypa.io +[Python installation guide]: https://docs.python-guide.org/starting/installation/ +[GitHub repo]: https://github.com/matplotlib/mpl-probscale +[tarball]: https://github.com/matplotlib/mpl-probscale/tarball/main diff --git a/docs/installation.rst b/docs/installation.rst deleted file mode 100644 index e139ad9..0000000 --- a/docs/installation.rst +++ /dev/null @@ -1,51 +0,0 @@ -.. highlight:: shell - -============ -Installation -============ - - -Stable release --------------- - -To install mpl-probscale, run this command in your terminal: - -.. code-block:: console - - $ pip install probscale - -This is the preferred method to install mpl-probscale, as it will always install the most recent stable release. - -If you don't have `pip`_ installed, this `Python installation guide`_ can guide -you through the process. - -.. _pip: https://pip.pypa.io -.. _Python installation guide: http://docs.python-guide.org/en/latest/starting/installation/ - - -From sources ------------- - -The sources for mpl-probscale can be downloaded from the `Github repo`_. - -You can either clone the public repository: - -.. code-block:: console - - $ git clone git://github.com/matplotlib/mpl-probscale - -Or download the `tarball`_: - -.. code-block:: console - - $ curl -OL https://github.com/matplotlib/mpl-probscale/tarball/master - -Once you have a copy of the source, you can install it with: - -.. code-block:: console - - $ pip install . - - -.. _Github repo: https://github.com/matplotlib/mpl-probscale -.. _tarball: https://github.com/matplotlib/mpl-probscale/tarball/master diff --git a/docs/readme.md b/docs/readme.md deleted file mode 100644 index d139312..0000000 --- a/docs/readme.md +++ /dev/null @@ -1,2 +0,0 @@ -```{include} ../README.md -``` \ No newline at end of file diff --git a/docs/tutorial/closer_look_at_plot_pos.ipynb b/docs/tutorial/closer_look_at_plot_pos.ipynb index da9055d..cf11908 100644 --- a/docs/tutorial/closer_look_at_plot_pos.ipynb +++ b/docs/tutorial/closer_look_at_plot_pos.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Using different formulations of plotting positions\n", + "# Plotting Positions\n", "\n", "## Computing plotting positions\n", "\n", diff --git a/docs/tutorial/closer_look_at_viz.ipynb b/docs/tutorial/closer_look_at_viz.ipynb index 2a7f82b..519703a 100644 --- a/docs/tutorial/closer_look_at_viz.ipynb +++ b/docs/tutorial/closer_look_at_viz.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# A closer look at probability plots\n", + "# Probability Plots in Depth\n", "\n", "## Overview\n", "\n", diff --git a/docs/tutorial/getting_started.ipynb b/docs/tutorial/getting_started.ipynb index 6f544cb..2c7dab4 100644 --- a/docs/tutorial/getting_started.ipynb +++ b/docs/tutorial/getting_started.ipynb @@ -4,7 +4,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "# Getting started with `mpl-probscale`\n", + "# Getting Started\n", "\n", "## Installation\n", "\n",