Package: neat-sciplots
neat-sciplotsNeatly format Matplotlib scientific plotsneat-sciplotsis a beta Python package thatneatlyformats scientific plots created with Matplotlib in a
user-friendly, yet highly customizable way.
It makes typesetting in LaTeX possible and comes with several methods that makes plotting more
straightforward and less cluttered, without sacrificing full control over plot settings.Two examples of plots that have been created with neat-sciplots:The neat-sciplots package was developed byAndreas Führin May 2021.Installation and getting startedTo install the latest release from PyPI, execute the following command:pip install neat-sciplotsTo install the latest commit, please use the the following command:pip install git+https://github.com/andreasfuhr/neat-sciplots.gitFormatting plots in Matplotlib is based on a functionalwith-statement context. A MWE can be demonstrated as follows:importmatplotlib.pyplotaspltimportsciplot# Define x and y...withsciplot.style():plt.plot(x,y)plt.show()If a LaTeX distribution is not available,use_latex=Falsemust be passed as an argument tosciplot.style().
For demonstrations of plotting that covers all packages features, see eitherexample_plots.pyin theexample_plotsdirectory.OverviewKey Features:User-friendly. Astyle context manageris used for all Matplotlib related user code and can be passed several
arguments to alter the look of the plot, such as:LaTeX typesettingserif or sans serif fontdark modelocalestring (for correct decimal
separator etc.)Implements LaTeX kernel for typesetting plots. A versatile LaTeX preamble is included that is specifically
created and optionally editable for mathematics- and physics-oriented papers, theses and presentations. Both thesiunitxandphysicsLaTeX packages are for example
included by default in the parameter settings.Easy customization. Most settings have been moved to parameters files, which are imported to the context manager and
configured withmatplotlibrc. Theuser is encouraged to editthese accessible and highly readable YAML parameters
files, whom can be found with thesciplot.get_paramters_dir()method.Includes a set of useful methods relevant during plotting:sciplot.set_size_cm()for setting figure sizes in centimeterssciplot.set_legend()for customizing the content and position of plot legendssciplot.get_color_lst()for extracting a list of colors of specified length and from a given Seaborn colormapsciplot.save_time_stamped_figurefor saving plots in an easy manner with time stamped file namesDisadvantages:Slow. LaTeX figures can take quite some time to compile. Loading the parameters is however not known from experience
to be time consuming.Only compatible with Python 3.7 and later. The 3.3.4 version of Matplotlib fixes several bugs that directly solves
some earlier issues with this package.It should be noted that although this package is in many ways similar to[1], which is a recommended
alternative approach, neat-sciplots has been independently developed and has a multitude of structural and functional
differences.Citing neat-plotsTo cite this Python package, please use the following BibTeX citation:@article{neat-sciplots,
  author       = {Andreas H. Führ},
  title        = {{andreasfuhr/neat-sciplots}},
  month        = may,
  year         = 2021,
  version      = {0.7.8},
}Note that under the current license, citing this package is not necessary. The creator will however be happy and
thankful for any recognition.Future improvementsThe package is still in its infancy and is planned to be expanded in features and configurability. Here is a list of
what is in the pipeline:Documentation of source codeInstructions on how to install a local LaTeX distributionMaking it possible to choose LaTeX fonts. As of currently,Computer Modern RomanandComputer Modern Roman Sans
Serifare the only two font options for both text and mathematical notation.Test suite for further code developmentInclude example plots in documentationWrite instructions on how to use the packageAdd more themes. Letsciplot.style()take the argumenttheme=strortheme=List[str].Table of proposed themes:Name of themePriorityBackground colorFontSeaborn colormapFigure sizedefault1highwhiteCMR Sans Serifcubehelix-darkhighblack---antiquelowwhiteGaramondTBD-ieee_columnmediumwhite?2TBD88 mm3ieee_pagelowwhite?2TBD181 mm31: Initialised at start of context.2: One of the following Open Type fonts are suggested to be used: Times New Roman, Helvetica, Arial,
Cambria or Symbol[2].3: See[2]for a description of sizes that graphics should be.References[1]J.D. Garrett and H. Peng,garrettj403/SciencePlots,
ver. 1.0.7.
Zenodo,
Feb. 2021.
[Online].
doi:10.5281/zenodo.4106649[2]"Preparation of papers for IEEE Transactions and Journals (December 2013),"
in IEEE Transactions on Consumer Electronics,
vol. 63,
no. 1,
pp. c3-c3,
February 2017,
doi:10.1109/TCE.2017.7932035