Skip to main content

plotfa

plotfa defines a set of helper functions that will aid you in creating crisp and beautiful plots in Persian, using seaborn (preferably) or pure matplotlib.

Installation

plotfa can be installed using pip:

pip install plotfa

Basic Usage

After installing plotfa, we simply import it at the top of our file:

import plotfa

It's important to note that any bit of persian text that we want shown on the plot, must pass through the plotfa.fa() function. For simplicity, we explicitly import this function on the top:

from plotfa import fa

Now, let's say we want to create a little bar plot using seaborn, so:

import seaborn as sns
from plotfa import farsi as fa
import plotfa

sns.set_style('darkgrid')
# Set plot's settings
plotfa.set_font('B Yekan')  # It defaults to B Yekan already
plotfa.prettify()  # To make our plots look better

# We must wrap persian strings with the fa() function

y = [       
     fa('میله‌ی اول'),
     fa('میله‌ی دوم'),
     fa('میله‌ی سوم')
    ]
x = [
     10,
     20,
     15
    ]

sample_plot = sns.barplot(x, y) # save the returned plot object
# pass the plot object into modify_plot and set its title and labels
plotfa.modify_plot(plot=sample_plot,
                   title=fa('پلاتفا'),
                   xlabel=fa('تعداد'),
                   ylabel=fa('اسم میله'))

Running the above code, will result in the following plot: result of our basic usage

Metadata

Release files for plotfa 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for plotfa 0.0.5
File Size Uploaded
plotfa-0.0.5.tar.gz 4.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for plotfa 0.0.5
File Interpreter ABI Platform
plotfa-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 20.3 kB

Release files / plotfa-0.0.5.tar.gz

Download URL plotfa-0.0.5.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
d4e2a77fc740a03df229d3761f616131507dce20ec38b781186a88c13d083de0
BLAKE2b-256 checksum
How to use checksums
e13e820f1d1287ed5840664c776971afeff06288bf61682f0cc5de21f8bbf77b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

Release files / plotfa-0.0.5-py3-none-any.whl

Download URL plotfa-0.0.5-py3-none-any.whl
Size 16.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1daf3fc64d8a55746c727785e23836236b23f3fab911c63c5a0112c14c93a4e7
BLAKE2b-256 checksum
How to use checksums
2d4fc605b95e32631844d2c8b8d2aa4ff91a026d5ca31fca7e46d56f1a6e6108
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

1 release file

0.0.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page