Skip to main content

This package is for easy, convenient plotting in Python.

Project description

MatPlus

CI/CD Coverage Docs Documentation

MatPlus is a Python package that provides easy, convenient plotting capabilities built on top of matplotlib. It simplifies the creation of common visualization types with intuitive APIs.

Installation

Install MatPlus using pip:

pip install MatPlus

Quickstart

Bar Plot

import numpy as np
from MatPlus import BarPlot

x = np.array([1, 2, 3, 4, 5])
y = np.array([10, 15, 7, 12, 9])

bar = BarPlot(x, y)
bar.plot()

Scatter Plot

from MatPlus import ScatterPlot

x = [1, 2, 3, 4, 5]
y = [1, 4, 9, 16, 25]

# Basic scatter plot
scatter = ScatterPlot(x, y)
scatter.plot()

# Scatter with custom sizes and colors
sizes = [10, 20, 30, 40, 50]
colors = [0.1, 0.5, 0.7, 0.9, 1.0]
scatter = ScatterPlot(x, y, sizes=sizes, colors=colors, vmin=0, vmax=1)
scatter.plot()

Line Plot

from MatPlus import LinePlot

# Single line plot
x = [1, 2, 3, 4, 5]
y = [1, 4, 9, 16, 25]
line_plot = LinePlot(x, y)
line_plot.plot()

# Multiple line plot
x = [[1, 2, 3], [1, 2, 3, 4]]
y = [[1, 2, 3], [4, 3, 2, 1]]
line_plot = LinePlot(x, y, lowerlimx=0, upperlimx=5)
line_plot.plot()

Box Plot

from MatPlus import BoxPlot

data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
box = BoxPlot(data)
box.plot()

Histogram

from MatPlus import Histogram
import numpy as np

data = np.random.normal(0, 1, 1000)
hist = Histogram(data)
hist.plot()

Documentation

For detailed API documentation, visit our documentation site.

Examples

For detailed examples of MatPlus usage in jupyter notebooks, please refer to the examples in our GitHub

Contributing

Contributions are welcome, whether it is building new plots, fixing bugs, or writing documentation. Here's how to get started:

  1. Clone the repository:
git clone https://github.com/ac-i2i-engineering/MatPlus.git
cd MatPlus
  1. Create and activate a virtual environment:
python -m venv env
source env/bin/activate  # On Windows: env\Scripts\activate
  1. Install development dependencies:
pip install -r requirements.txt

Development Workflow

Pre-commit Hooks

We use pre-commit hooks to ensure code quality. Install them with:

pre-commit install

And run them with:

pre-commit run

This will automatically style your code before each commit.

Unit Testing

Run the test suite with pytest:

pytest

Our standard is 95% code coverage.

Documentation

Adding Docstrings for Auto-documentation

To ensure your code is properly documented for auto-generation, follow these guidelines for adding docstrings to your MatPlus classes and methods:

Docstring Guidelines

To ensure consistency and support automatic documentation generation, MatPlus adheres to the NumPy-style docstring format. Contributors should follow these guidelines when writing docstrings for classes and methods:

General Structure

All classes and functions must have a descriptive docstring with clear sections:

  • Short Summary: A concise one-line summary.
  • Extended Description: (Optional) A more detailed explanation providing additional context or usage notes.
  • Parameters: List all parameters with type annotations, optionality, defaults, and descriptions.
  • Returns: Clearly state the type and description of the returned value(s).
  • Examples: Include examples demonstrating common usage.
Example Template
class ClassName:
    """
    Short summary of the class or method.

    Extended description if necessary, explaining the purpose and usage in more detail.

    Parameters
    ----------
    param1 : type
        Description of the first parameter.
    param2 : type, optional
        Description of the second parameter with default value if applicable. Default is value.

    Returns
    -------
    return_type
        Description of the return value.

    Examples
    --------
    >>> example_var = ClassName(param1, param2)
    >>> example_var.method()
    """

    def method(self, param1):
        """
        Short method summary.

        Parameters
        ----------
        param1 : type
            Description of parameter.

        Returns
        -------
        return_type
            Description of return value.

        Examples
        --------
        >>> instance = ClassName()
        >>> instance.method(param1)
        """
Additional Notes
  • Use clear and direct language.
  • Maintain consistency in formatting, indentation, and spacing.
  • Examples should be executable and demonstrate common usage scenarios.

Following this structure ensures clarity and helps automate documentation generation effectively.

PR Workflow

To contribute effectively to MatPlus, follow this Pull Request (PR) workflow:

  1. Fork the Repository:

    • Fork the MatPlus repository to your GitHub account.
  2. Create a Feature Branch:

    git checkout -b feature/your-feature-name
    

    Use descriptive branch names, such as feature/bar-plot-enhancement or fix/scatter-plot-bug.

  3. Make Your Changes:

    • Implement your feature or fix.
    • Follow coding standards and ensure documentation consistency.
  4. Run Tests Locally:

    pytest
    
    • Ensure your changes pass all tests and meet the minimum coverage requirement (95%).
  5. Commit and Push Your Changes:

    git add .
    git commit -m "Detailed description of your changes"
    git push origin feature/your-feature-name
    
  6. Open a Pull Request:

    • Navigate to your forked repository on GitHub.
    • Click on "Compare & pull request".
    • Provide a clear and detailed description of the changes you've made.
    • Reference any relevant issues.
  7. Code Review:

    • Address review comments promptly and update your PR accordingly.
  8. Merge and Clean Up:

    • Once approved and merged, delete your feature branch.

Following this workflow helps maintain a streamlined and efficient collaboration process.

License

This project is licensed under the MIT License - see the LICENSE file for details.

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

matplus-0.1.1.tar.gz (10.8 kB view details)

Uploaded Source

Built Distribution

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

matplus-0.1.1-py3-none-any.whl (14.5 kB view details)

Uploaded Python 3

File details

Details for the file matplus-0.1.1.tar.gz.

File metadata

  • Download URL: matplus-0.1.1.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for matplus-0.1.1.tar.gz
Algorithm Hash digest
SHA256 115fc75d400c94784c4fd598669a27975dd08e3d95b73cc2709addf0f0fde9d2
MD5 938630029df7742739379cd2ce5fe104
BLAKE2b-256 069ba388a7933993c5a376d77a960ae953bafd3d40321dbbf9885daaa8aae741

See more details on using hashes here.

Provenance

The following attestation bundles were made for matplus-0.1.1.tar.gz:

Publisher: publish.yml on ac-i2i-engineering/MatPlus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file matplus-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: matplus-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for matplus-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 20d24025d3a599edbab99252ece9472460b2cb37c14eed9384c9e7bfab0e77aa
MD5 9cb7dce037a9ab6d5df4a7645e7e28be
BLAKE2b-256 ccc0e2c12299d58523b5eb70d0ecab02de750a76bf1e8742e3b24d5560c58efa

See more details on using hashes here.

Provenance

The following attestation bundles were made for matplus-0.1.1-py3-none-any.whl:

Publisher: publish.yml on ac-i2i-engineering/MatPlus

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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