Skip to main content

A simple matplotlib wrapper to avoid writing multiple plt. statements.

Project description

beautifyPlot

A simple matplotlib wrapper to avoid writing multiple plt. statements.

Installation

pip install beautifyPlot

Usage

matplotlib code:

import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0,100,1)
y = x**3

plt.plot(x,y,label='y=f(x)')
plt.title("test plot")
plt.xlim([0,10])
plt.ylim([0,1000])
plt.legend(fontsize=15)
plt.tight_layout()

Using beautifyPlot

from beautifyPlot.bplt import beautifyPlot
import numpy as np
x = np.arange(0,100,1)
y = x**3

plt.plot(x,y,label='y=f(x)')

plotArgs = {
    'title'           : ['test plot'], ## Use list to pass a set of arguments to the function
    'xlim'            : [0,10],
    'ylim'            : [0,1000],
    'legend'          : {'fontsize':15, 'loc':'best'}, ## Use dictionary to specify arguments
    'tight_layout'    : [] ## Leave list empty if there is nothing to pass
}
beautifyPlot(plotArgs)

## Next steps: Save plotArgs as JSON or use the same plot arguments in a different subplot/plot.

Using beautifyPlot (with shorthand notation)

from beautifyPlot.bplt import beautifyPlot
import numpy as np
x = np.arange(0,100,1)
y = x**3

plt.plot(x,y,label='y=f(x)')

plotArgs ={
    't'   : ['test plot'],
    'xl'  : [0,10],
    'yl'  : [0,1000],
    'l'   : {'fontsize':15, 'loc':'best'},
    't_l' : []
}
beautifyPlot(plotArgs)

Built-in shorthand notations

shorthand command
"l" plt.legend
"t_p" plt.tick_params
"t_l" plt.tight_layout
"t" plt.title
"xl" plt.xlim
"yl" plt.ylim
"xt" plt.xticks
"yt" plt.yticks
"xlab" plt.xlabel
"ylab" plt.ylabel
"xs" plt.xscale
"ys" plt.yscale

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

beautifyPlot-0.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

beautifyPlot-0.2-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file beautifyPlot-0.2.tar.gz.

File metadata

  • Download URL: beautifyPlot-0.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for beautifyPlot-0.2.tar.gz
Algorithm Hash digest
SHA256 ad63ef3fdea1d00636f10e36b7f614ca1c25b1dfbb7b002345ab4bd464c8eb6b
MD5 4858bf57ae0d11edf9541dcd328e6eb1
BLAKE2b-256 ba697ecdb2fbc4f67c1f8549197c22e2af71afb4accb744068a3c58677cf0367

See more details on using hashes here.

File details

Details for the file beautifyPlot-0.2-py3-none-any.whl.

File metadata

  • Download URL: beautifyPlot-0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.15

File hashes

Hashes for beautifyPlot-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8db2d0757f87b88189421ef183ce3d997dccb8eb38c70b93dbf40f36544e4211
MD5 1d9839f3bc2930b2b84e604a9ba53850
BLAKE2b-256 cdf2dbb6553bd77faabc54deb79c0600fe012db3ebbd61d368205c47be78ddf4

See more details on using hashes here.

Supported by

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