Skip to main content

An easy graph formatting tool for matplotlib

Reason this release was yanked:

Installation description is wrong. Functionality-wise, there is no problem.

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?

Just download the szkGraph.py file on your computer (preferably to the dedicated folder), and import the file to your Python code. example.py shows you how to import the file even from different directory.

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.1.tar.gz (4.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.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: szkgraph-0.0.1.tar.gz
  • Upload date:
  • Size: 4.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.1.tar.gz
Algorithm Hash digest
SHA256 17ecb527d82b6c5c894feac21046a3722a22fd10efc043f55c663e11fbdd00f8
MD5 534c29c3276e976be4f6056f02a192b4
BLAKE2b-256 28d4326648908fc0c9d26278c4b17564194067b4bc1a81a822b7951e90e2c666

See more details on using hashes here.

File details

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

File metadata

  • Download URL: szkgraph-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 750e6b9addd5d99c184ed6ca58c9fb77ba8b558dbb10f0c6f20c82fa149684f4
MD5 afa64522aa77271d3f09eb77dd79088c
BLAKE2b-256 4c37e8142e1bf05acb1515ad8859a165f23d6ee8cea992ecab92426c2df3f3b7

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