{"id":13737605,"url":"https://github.com/killiansheriff/LovelyPlots","last_synced_at":"2025-05-08T14:33:11.272Z","repository":{"id":49470512,"uuid":"517688919","full_name":"killiansheriff/LovelyPlots","owner":"killiansheriff","description":"Matplotlib style sheets to nicely format figures for scientific papers, thesis and presentations while keeping them fully editable in Adobe Illustrator.","archived":false,"fork":false,"pushed_at":"2024-03-25T02:32:20.000Z","size":606,"stargazers_count":868,"open_issues_count":0,"forks_count":38,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-08T04:11:23.185Z","etag":null,"topics":["adobe-illustrator","latex","matplotlib","matplotlib-figures","phd","phd-thesis","scientific-publications"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/killiansheriff.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"killiansheriff","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"custom":null}},"created_at":"2022-07-25T14:01:48.000Z","updated_at":"2025-04-06T21:52:34.000Z","dependencies_parsed_at":"2024-03-25T03:00:52.309Z","dependency_job_id":null,"html_url":"https://github.com/killiansheriff/LovelyPlots","commit_stats":{"total_commits":88,"total_committers":5,"mean_commits":17.6,"dds":"0.15909090909090906","last_synced_commit":"3cfd78fb4d5a3d8c9f89feb7742f18340ffd2fb7"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killiansheriff%2FLovelyPlots","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killiansheriff%2FLovelyPlots/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killiansheriff%2FLovelyPlots/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/killiansheriff%2FLovelyPlots/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/killiansheriff","download_url":"https://codeload.github.com/killiansheriff/LovelyPlots/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253085775,"owners_count":21851699,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["adobe-illustrator","latex","matplotlib","matplotlib-figures","phd","phd-thesis","scientific-publications"],"created_at":"2024-08-03T03:01:54.756Z","updated_at":"2025-05-08T14:33:07.369Z","avatar_url":"https://github.com/killiansheriff.png","language":"Python","funding_links":["https://github.com/sponsors/killiansheriff"],"categories":["Python"],"sub_categories":[],"readme":"# LovelyPlots\n![PyPI Version](https://img.shields.io/pypi/v/LovelyPlots.svg) ![PyPI Downloads](https://static.pepy.tech/badge/LovelyPlots) [![doi](https://img.shields.io/badge/DOI-10.5281%2Fzenodo.6903937-blue)](\nhttp://doi.org/10.5281/zenodo.6903936) ![tests](https://github.com/killiansheriff/LovelyPlots/actions/workflows/python-tests.yml/badge.svg)\n\n\u003e [!WARNING]\n\u003e As of version 1.0.0, you need to add ``import lovelyplots`` before setting the style (``plt.style.use('ipynb')``).\n\nLovelyPlots is a repository containing ``matplotlib`` style sheets to nicely format figures for scientific papers, thesis and presentations while keeping them fully editable in ``Adobe Illustrator``. Additonaly, ``.svg`` exports options allows figures to automatically adapt their font to your document's font. For example, ``.svg`` figures imported in a ``.tex`` file will automatically be generated with the text font used in your ``.tex`` file.\n\n\u003cp align=\"center\" width=\"50%\"\u003e\n    \u003cimg width=\"70%\" src=\"figs/plots/ipynb+use_mathtext.svg\"\u003e\n\u003c/p\u003e\n\n# Installation\n\n```bash\n# to install latest PyPI release\npip install LovelyPlots\n\n# to install latest GitHub commit\npip install --upgrade git+https://github.com/killiansheriff/LovelyPlots.git\n```\n\nThe pip installation will move all of the ``matplotlib`` style files ``*.mplstyle`` into the appropriate ``matplotlib`` directory.\n\n# Usage\n\nLovelyPlots main style is called ``ipynb``. To use it, add the following lines to the begining of your python scripts:\n\n```python\nimport lovelyplots\nimport matplotlib.pyplot as plt\nplt.style.use('ipynb')\n```\n\nStyles can be combined:\n\n```python\nimport lovelyplots\nimport matplotlib.pyplot as plt\nplt.style.use(['ipynb','colorsblind34'])\n```\n\nIn the above case, the ``ipynb`` default color cycle will be overwritten by a 34 colors colorblind safe color cycle called ``colorsblind34``.\n\nIf you only wish to apply a style on a specific plot, this can be achieved using:\n\n```python\nimport lovelyplots\nimport matplotlib.pyplot as plt\n\nwith plt.style.context('ipynb'):\n  fig, ax = plt.subplots()\n  ax.plot(x, y)\n```\n\n# Examples\n\nA few styles are presented here, please see [Styles](#Styles) for a list of all implemented styles. The script used to generate these plots can be found [here](examples/plot.py).\n\n:warning: If you use the ``use_mathtext`` style, ``Adobe Illustrator`` might fail to nicely detect text objects. Please see [here](#Tips-and-Tricks) for work arounds.\n\n\nThe ``['ipynb', 'use_mathtext']`` style:\n\n![](figs/plots/ipynb%2Buse_mathtext.svg)\n\nThe ``['ipynb', 'use_mathtext','colors10-markers']`` style:\n\n![](figs/plots/ipynb%2Buse_mathtext+colors10-markers.svg)\n\nThe ``['ipynb', 'use_mathtext','colors5-light']`` style:\n\n![](figs/plots/ipynb%2Buse_mathtext+colors5-light.svg)\n\nThe ``['ipynb', 'use_mathtext', 'colors10-ls']`` style:\n\n![](figs/plots/ipynb%2Buse_mathtext+colors10-ls.svg)\n\nThe ``['ipynb']`` style:\n\n![](figs/plots/ipynb.svg)\n\nThe ``['paper', 'use_mathtext']`` style:\n\n![](figs/plots/paper+use_mathtext.svg)\n\n# Styles\n\nLovelyPlots main style is called ``ipynb``. The latter by default sets the figure size to ``(4.5, 3.46) inches``, uses the default ``matplotlib`` font, activate scientific notation and makes sure your ``matplotlib`` exports will be editable in ``Adobe Illustrator``. Its default color cycle was set to ``colors10``.\n\n## Color cycles\n\nA multitude of color cycles were implemented:\n\n``colors5-light``\n\n![](figs/colors/colors5-light.png)\n\n``colors5``\n\n![](figs/colors/color5.png)\n\n``colors10``\n\n![](figs/colors/color10.png)\n\n``colorsblind10``\n\n![](figs/colors/colorsblind10.png)\n\n``colorsblind34``\n\nCan be seen [here](figs/colors/colorsblind34.png).\n\n\n## Lines styles, markers and combinations styles\n\nLine styles, markers styles and combinations can be set using the following styles: `ls5`, `marker7`, `colors10-ls`, `colors10-markers`.\n\n## Color maps\nDefault ``matplotlib`` colormaps were implemented and can be used by adding the following styles: ``cmap-viridis``, ``cmap-inferno``, ``cmap-cividis``, ``cmap-magma``, ``cmap-plasma``.\n\n## Utils\n\nSpecific ``matplotlibrc`` parameters can be turned ``on/off`` using the following utilities styles: ``svg_no_fonttype``, ``use_mathtex``, ``use_tex``.\n\n## Fonts\n\nBy default the ``ipynb`` style uses the default ``matplotlib`` font. However, one can set its favorite font from a TIFF file:\n\n```python\nimport lovelyplots as lp\nimport matplotlib.pyplot as plt\n\nplt.style.use('ipynb')\nlp.utils.set_font('my_font.tiff')\n```\n\n\n\n\n# Tips and Tricks\n\n## Adobe Illustrator\n\nUnfortunately, ``mathtext`` (and thus nicely formated scientific notation) will mess up ``Adobe illustrator`` ability to detect text objects, and is thus not activated by default. If you wish to use it, please add the style ``use_mathtext``.\n\n## Latex and SVG files\nBy default, the ``ipynb`` style sets ``svg.fonttype: none``. This allows for plots saved as ``.svg`` not to carry font information. Consequently, when opened in another environement, the plot will be generated with the default system font.\n\nFor example, this allows ``.svg`` plots imported inside a ``Latex`` file to directly be generated with the proper document font, without you having to manually edit the fonts to match your document's font. Additonally, you can open the ``.svg`` file as  text file, find the ugly ``1e10`` scientific notation and replace it with ``$10^10$`` so that it is nicely formated when included in your ``.tex`` file.\n\nAn example of how to show an svg in a ``.tex`` file:\n\n```tex\n\\usepackage{svg}\n\n\\begin{figure}[htbp]\n  \\centering\n  \\includesvg{myfig.svg}\n\\end{figure}\n```\n## Retina displays\n\nFor those using ``IPython`` notebooks, you can set retina display support by adding the following lines to the begining on your python script:\n\n\n```python\nimport lovelyplots as lp\nlp.utils.set_retina()\n```\n## Useth in Google Colab\nTo use on Google Colab, you will need to run the following code:\n```python\n!pip install lovelyplots\nimport lovelyplots\nplt.style.reload_library()\nplt.style.use('ipynb')\n```\n\n# Acknowledgements\n\nThis reprository was inspired by [SciencePlots](https://github.com/garrettj403/SciencePlots), but adds different styles and crucial functionalities for useth in ``.tex`` files and ``Adobe Illustrator``.\n\n\n# Citing \n\nIf you use LovelyPlots, please cite: \n\n    @software{sheriff_lovelyplots_2022,\n      author       = {Killian Sheriff},\n      title        = {{LovelyPlots, a collection of matplotlib \n                       stylesheets for scientific figures}},\n      month        = jul,\n      year         = 2022,\n      publisher    = {Zenodo},\n      doi          = {10.5281/zenodo.6903936},\n    }\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkilliansheriff%2FLovelyPlots","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkilliansheriff%2FLovelyPlots","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkilliansheriff%2FLovelyPlots/lists"}