Skip to main content

An easy graph formatting tool for matplotlib

Project description

szkGraph - simple style formatter for matplotlib

This is a useful Python codes to simply modify the style of matplotlib for your presentation and academic papers. Any type of suggestions, feedbacks, and upgrades are welcome.

How to install?

Install using pip. python -m pip install -U szkGraph

How to use?

Call szkGraph.prepare() to initialize the figure. Use the returned fig, ax for plotting. After plotting and modifying your figure, export the figure with szkGraph.finalize().

szkGraph.prepare(xtitle=None, ytitle=None, w=None, h=None, r=0.7, font="arial", fontsize=20)

Paramters

  • xtitle: str, optional Title of x-axis.
  • ytitle: str, optional Title of y-axis.
  • w: float or str, optional Float for specifying the width in inches, str for specifying the width relative to powerpoint slide or academic paper. Use pp1/X for one-X-th of powerpoint slide (16:9), ppX for X times of powerpoint slide (16:9), and 1col etc. for figures in academic paper.
  • h: float, optional Height in inches.
  • r: float, optional Ratio of height to width.
  • font: str, optional Fontname. It should be either arial or times.
  • fontsize: int, optional Fontsize in pt.

Returns

  • fig: matplotlib.figure
  • ax: matplotlib.axes

finalize(fig, ax, fn_figout, lims=[None, None, None, None], dpi=300, comp={}, tight=True, pad=0.2, xspace=None, yspace=None)

Paramters

  • fig: matplotlib.figure
  • ax: matplotlib.axes
  • fn_figout: str Name of the output figure file. It could also be in absolute or relative path.
  • lims: list of floats, optional Range of axis in one list as [xmin, xmax, ymin, ymax].
  • dpi: int, optional Value of dpi.
  • pil_kwargs: dict, optional Dictionary that will be directly passed to PIL.Image.Image.save.
  • tight: bool, optional Whether to use matplotlib.pyplot.tight_layout().
  • pad: float, optional Padding for matplotlib.pyplot.tight_layout().
  • xspace: float or tuple of floats Float for specifying x-tick spacing, tuple of floats for specyfing (x-tick spacing, offset). See matplotlib.ticker.MultipleLocator().
  • yspace: float or tuple of floats Float for specifying y-tick spacing, tuple of floats for specyfing (y-tick spacing, offset). See matplotlib.ticker.MultipleLocator().

Returns

  • fig: matplotlib.figure
  • ax: matplotlib.axes

License

szkGraph is available under MIT license. See the LICENSE file for more info.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

szkgraph-0.0.2.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

szkgraph-0.0.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file szkgraph-0.0.2.tar.gz.

File metadata

  • Download URL: szkgraph-0.0.2.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.9

File hashes

Hashes for szkgraph-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7a7a36c63e87ac83bdfc8758369fa4aa173abc3f26f7964d03007a62b9131ba6
MD5 1e66d3291f3aad2ead9984321ebeedc6
BLAKE2b-256 23d8437d95c9b879e39dab861b12964cd219429e9037cee7bccbba64e73cb5d6

See more details on using hashes here.

File details

Details for the file szkgraph-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: szkgraph-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.9

File hashes

Hashes for szkgraph-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a1a090a2a802169b811c76e83b1ed46e8df2409660c21a7fa13c8d35d16cf18c
MD5 e94392fb9a9ee67154ccd9b132c0fed9
BLAKE2b-256 31edd13d1e70ba9cb33202018c4ce9cde6d721a3f319b36e5344ab6571461233

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page