Package to make plots easily.
Project description
Pyfigure98
A python package to create plots and figures easily
If you have ever tried to make figures in python, you may have faced the same issues that annoyed me: a lot of copy/pasting between projects, countless hours spent on the internet searching for how to change the size of this or that thing again ? and always searching for specific things like axes formated specifficaly for angles, logarithms, times, ...
With this project, no more hurdles.
Features
This project is based on matplotlib
and contains many methods to facilitate the creation of complex figures. Here is a non-exaustive list of its functionalities:
- Hability to put multiple graphs on a single figure.
- Hability to have more than one y-axis.
- Hability to format the x-axis to measure time, angles and logarithmic scales.
- Hability to format de y-axis to measure angles and logarithmic scales.
- Automated and unified font sizes, defined in templates.
- And many more !
Documentation
Installation
To install this package using pip, simply run
pip install pyfigure98
Usage
In order to use this package, create a new Figure
object, and add a new figure to it:
from pyfigure98 import Figure
import numpy as np # Used later
myNewFigure = Figure()
myNewFigure.addFigure(template="default", rows=1, cols=1)
For more informations on how to use the
template
variable and how to modify templates, see section.
Next, you can add a new graph to your newly-created figure:
graphOfMyNewFigure = myNewFigure.addgraph("myGraph")
Modify the x-axis and y-axis by using these methods:
graphOfMyNewFigure.setAxisX(x_min=-10, x_max=10, label="x")
graphOfMyNewFigure.setAxisY(y_min=-5, y_max=10, label="f(x)")
Add a plot by using:
x = np.arange(-10, 10, 0.2)
y = (0.3*x)**3
graphOfMyNewFigure.plotStandard(x=x, y=y, label="example with f(x)=0.3*x^3", color="red")
Don't forget to add a title and a legend !
myNewFigure.setTitle("My figure")
graphOfMyNewFigure.setTitle("my graph")
graphOfMyNewFigure.setLegend()
Finally, save you figure:
myNewFigure.figSave('myfig')
After all these steps, you should obtain this:
This example is, of course, trivial. But it illustrates the basic principles of this package.
Of course, there are many more methods available !
Templates
Examples
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
Built Distribution
Hashes for pyfigure98-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e494bc63c7fdeba63e814b6b17648b55e7554d2ccaf7fa23c246675fd2016f60 |
|
MD5 | 57527e7775b70e7bd7d203c786f7f395 |
|
BLAKE2b-256 | 9773ab7ec29c07f88381d3ee68c7320228a2a42ac998173bedcaca4678416d4a |