{"id":37063518,"url":"https://github.com/mcuntz/mcplot","last_synced_at":"2026-01-14T07:14:58.415Z","repository":{"id":257811649,"uuid":"866240152","full_name":"mcuntz/mcplot","owner":"mcuntz","description":"A Python package with a plotting class and routines for publication-ready graphics","archived":false,"fork":false,"pushed_at":"2025-05-30T22:17:28.000Z","size":36650,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-25T03:38:15.054Z","etag":null,"topics":["colors","colorscheme","graphics","matplotlib","plotting","publication-quality-plots","python"],"latest_commit_sha":null,"homepage":"https://mcuntz.github.io/mcplot/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcuntz.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.rst","dei":null,"publiccode":null,"codemeta":null,"zenodo":".zenodo.json","notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-10-01T22:23:15.000Z","updated_at":"2025-05-30T22:13:47.000Z","dependencies_parsed_at":"2024-10-05T16:20:33.765Z","dependency_job_id":"2afd6f77-1582-4ffe-94b6-cf4cdf1286f5","html_url":"https://github.com/mcuntz/mcplot","commit_stats":null,"previous_names":["mcuntz/mcplot"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/mcuntz/mcplot","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcuntz%2Fmcplot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcuntz%2Fmcplot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcuntz%2Fmcplot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcuntz%2Fmcplot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcuntz","download_url":"https://codeload.github.com/mcuntz/mcplot/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcuntz%2Fmcplot/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28412746,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T05:26:33.345Z","status":"ssl_error","status_checked_at":"2026-01-14T05:21:57.251Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["colors","colorscheme","graphics","matplotlib","plotting","publication-quality-plots","python"],"created_at":"2026-01-14T07:14:57.897Z","updated_at":"2026-01-14T07:14:58.408Z","avatar_url":"https://github.com/mcuntz.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"mcplot\n======\n\nA Python package with a plotting class and routines for publication-ready graphics.\n\n|DOI| |PyPI version| |Conda version| |License| |Build Status| |Coverage Status|\n\n\nAbout mcplot\n------------\n\n``mcplot`` provides a class that combines methods to easily produce\npublication-ready graphics on light or black background. It includes a\nlarge number of colormaps collected from different sources. There are\na number of functions that help to position plots, number plot panels,\nor write text on a graph.\n\nThe complete documentation of ``mcplot`` is available at:\n\n   https://mcuntz.github.io/mcplot/\n\n\nInstallation\n------------\n\nThe easiest way to install is via `pip`:\n\n.. code-block:: bash\n\n   python -m pip install mcplot\n\nor via `conda`:\n\n.. code-block:: bash\n\n   conda install -c conda-forge mcplot\n\nRequirements\n   * numpy_\n   * matplotlib_\n   * pandas_\n\n\nCalling a plotting script from the command line\n-----------------------------------------------\n\n``mcplot`` provides a class that has methods for opening and closing\ndifferent plotting backends, setting layout options, as well as having\na command line interface. A most basic example is using the method\n`plot_test`, which just plots two sinusoidal curves. A file\n`mcplot_test.py` could be:\n\n.. code-block:: python\n\n   # file: mcplot_test.py\n   from mcplot import mcPlot\n\n   if __name__ == '__main__':\n       iplot = mcPlot(desc='Test mcPlot',\n                      argstr='No argument wanted')\n       iplot.plot_test()\n       iplot.close()\n\nThis script `mcplot_test.py` can be called on the command line. '-h'\ngives a short help:\n\n.. code-block:: bash\n\n   python mcplot_test.py -h\n\ngives the help message::\n\n   usage: mcplot_test.py [-h] [-o plotname] [-s] [-t outtype] [-u]\n                         [-w] [--dpi number] [--transparent] [args ...]\n\n   Test mcPlot\n\n   positional arguments:\n     args                  No argument wanted\n\n   options:\n     -h, --help            show this help message and exit\n     -o plot_filename, --output plot_filename,\n     -p plot_filename, --plotname plot_filename\n                           Name of plot output file for types pdf, html,\n\t\t\t   d3, or hvplot, and name basis for type png\n\t\t\t   (default: class_mcplot).\n     -s, --serif           Use serif font; default sans serif.\n     -t outtype, --type outtype\n                           Output type is pdf, png, html, d3, or hvplot\n                           (default: open screen windows).\n     -u, --usetex          Use LaTeX to render text in pdf, png and html.\n     -w, --white           White lines on transparent or black background;\n                           default: black lines on transparent or\n                           white background.\n     --dpi number          Dots Per Inch (DPI) for non-vector output types or\n                           rasterized maps in vector output (default: 300).\n     --transparent         Transparent figure background\n                           (default: black or white).\n     --font name           Font name or LaTeX package name\n                           (default: DejaVuSans or DejaVuSerif (serif) and\n\t\t\t   MyriadPro or ComputerModern (serif) if --usetex\n\n\n.. code-block:: bash\n\n   python mcplot_test.py\n\nopens a standard Matplotlib plotting window with the test plot.\n   \n.. code-block:: bash\n\n   python mcplot_test.py -t pdf -o test1.pdf\n\nwrites the plot into the PDF file `test1.pdf` using the sans-serif\nfont `DejaVuSans` that comes with Matplotlib. It will use the serif\nfont DejaVueSerif with the command line option `-s`. It will use LaTeX\nto render text with the `-u` option. `-u -s` uses LaTeX's standard\nComputer Modern font. It uses MyriadPro as sans-serif font in LaTeX,\nwhich must be installed (see section `Myriad Pro`_).\n\nBy default, ``mcPlot`` plots onto a DIN A4 page, which facilitates\nchoices of font sizes, etc. The output can easily be cropped with the\nutility pdfcrop_ which can be acquired from CTAN_. The standard\nsubplots are on a 2x3 grid. The plot will be tightly cropped if the\noutput type is `png`. Plot resolution can be set for `png` as well\n(`--dpi`) with standard being 300 dpi. PNG plots can have transparent\nbackground (`--transparent`), for example to use in presentations.\n\nThe command line switch `-w` swaps foreground and backgroud colors,\ni.e. uses white lines on black background. This is used if you do\npresentations with black background.\n\nIn summary, the standard command line options allow to use the same\nscript to design a plot using plotting windows on screen, produce the\npublication ready plots in a PDF file (`-t`, `-o`, `-u` options), and\nmake the same plot with dark background for presentations (`-t`, `-o`,\n`-u`, `-w` options).\n\n\nUsing the plotting class\n------------------------\n\nThe class `mcPlot` can be extended. One normally would have at least a\nmethod to read data from a file and a method that produces a\nplot. This could give a script such as:\n\n.. code-block:: python\n\n   # file: mcplot_basic.py\n   import numpy as np\n   from mcplot import mcPlot\n\n\n   class myPlot(mcPlot):\n\n       def read_data(self):\n           # reading one file would use self.cargs[0] such as\n           # self.dat = np.loadtxt(self.cargs[0])\n           self.dat = np.arange(100)\n\n       def plot_fig_1(self):\n           import matplotlib.pyplot as plt\n\n           # make axes\n           fig = plt.figure()\n           ax = fig.add_subplot(3, 2, 1)\n\n           # plot\n           xx = self.dat / self.dat.size * 4. * np.pi\n           line1 = ax.plot(xx, np.sin(xx))\n           plt.setp(line1, linestyle='-', linewidth=self.lw,\n                    marker='', color=self.lcol1)\n\n           # show plot or write in file\n           self.plot_save(fig)\n\n\n   if __name__ == '__main__':\n       # open plot\n       iplot = myPlot(desc='A basic plot')\n       # read data\n       iplot.read_data()\n       # plot\n       iplot.plot_fig_1()\n       # close plot and possible output file\n       iplot.close()\n\nThe script could be called giving the name(s) of (an) input file(s) on\nthe command line, which is then accessible through `self.cargs`:\n\n.. code-block:: bash\n\n   python mcplot_basic.py -t png -o basic. input.csv\n\nEvery time `self.plot_save(fig)` is called, a figure is written to the\noutput file. A PDF file can have multiple pages. For PNG files, only\nthe start of the output files is given (here *basic.*) and will be\nextended by `f'{start}{self.ifig:04d}.png'`. The example would give\nthe outputfile `basic.0001.png`.\n\nSee the complete documentation of ``mcplot`` at: https://mcuntz.github.io/mcplot/\n\n\nLicense\n-------\n\n``mcplot`` is distributed under the MIT License. See the LICENSE_ file\nfor details.\n\nCopyright (c) 2021- Matthias Cuntz\n\n\n.. |DOI| image:: https://zenodo.org/badge/866240152.svg\n   :target: https://doi.org/10.5281/zenodo.13893825\n.. |PyPI version| image:: https://badge.fury.io/py/mcplot.svg\n   :target: https://badge.fury.io/py/mcplot\n.. |Conda version| image:: https://anaconda.org/conda-forge/mcplot/badges/version.svg\n   :target: https://anaconda.org/conda-forge/mcplot\n.. |License| image:: http://img.shields.io/badge/license-MIT-blue.svg?style=flat\n   :target: https://github.com/mcuntz/mcplot/blob/master/LICENSE\n.. |Build Status| image:: https://github.com/mcuntz/mcplot/actions/workflows/main.yml/badge.svg\n   :target: https://github.com/mcuntz/mcplot/actions/workflows/main.yml\n.. |Coverage Status| image:: https://coveralls.io/repos/github/mcuntz/mcplot/badge.svg?branch=main\n   :target: https://coveralls.io/github/mcuntz/mcplot?branch=main\n\n.. _CTAN: https://www.ctan.org/pkg/pdfcrop\n.. _LICENSE: https://github.com/mcuntz/mcplot/blob/main/LICENSE\n.. _Myriad Pro: https://github.com/mcuntz/setup_mac?tab=readme-ov-file#myriad-pro\n.. _matplotlib: https://matplotlib.org/\n.. _netCDF4: https://github.com/Unidata/netcdf4-python\n.. _numpy: https://numpy.org/\n.. _pandas: https://pandas.pydata.org/\n.. _pdfcrop: https://github.com/ho-tex/pdfcrop\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcuntz%2Fmcplot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcuntz%2Fmcplot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcuntz%2Fmcplot/lists"}