gnuplot-style


Namegnuplot-style JSON
Version 0.1.1 PyPI version JSON
download
home_pageNone
SummaryGnuplot-style aesthetics for matplotlib
upload_time2025-07-22 22:24:54
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT
keywords matplotlib gnuplot plotting visualization style
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # gnuplot-style

[![PyPI version](https://badge.fury.io/py/gnuplot-style.svg)](https://badge.fury.io/py/gnuplot-style)
[![Python versions](https://img.shields.io/pypi/pyversions/gnuplot-style.svg)](https://pypi.org/project/gnuplot-style/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

A Python package that provides gnuplot-style aesthetics for matplotlib plots.

## Features

- Easy-to-use API for applying gnuplot styles to matplotlib
- Support for gnuplot's default colors, line styles, markers, and patterns
- Modular design allowing selective application of styles
- Compatible with matplotlib's style system
- Includes pattern fills for histograms and bar charts

## Installation

```bash
pip install gnuplot-style
```

## Quick Start

```python
import matplotlib.pyplot as plt
import numpy as np
import gnuplot_style as gp

# Apply gnuplot aesthetics BEFORE creating figures
gp.use()  # Default: colors only

# Create your plots as usual
x = np.linspace(0, 2*np.pi, 100)
for i in range(4):
    plt.plot(x, np.sin(x + i*0.5), label=f'Series {i+1}')

plt.legend()
plt.show()
```

### Note on Axes Created Before Style Application

If you create axes before calling `gp.use()`, you need to explicitly apply the style:

```python
# If axes already exist
fig, ax = plt.subplots()

# Apply style
gp.use('cl')

# Apply the prop_cycle to existing axes
ax.set_prop_cycle(plt.rcParams['axes.prop_cycle'])

# Now plot with the new style
ax.plot(x, y)
```

## Style Options

The package provides several style combinations:

```python
# Individual components
gp.use('color')    # or 'c' - Just colors (default)
gp.use('line')     # or 'l' - Just line styles
gp.use('marker')   # or 'm' - Just markers

# Combinations
gp.use('color+line')    # or 'cl' - Colors + line styles
gp.use('color+marker')  # or 'cm' - Colors + markers
gp.use('all')          # or 'clm' - Everything combined
```

### Convenience Functions

```python
gp.colors()         # Apply colors only
gp.lines()          # Apply line styles only
gp.markers()        # Apply markers only
gp.colors_lines()   # Apply colors + lines
gp.colors_markers() # Apply colors + markers
gp.all()           # Apply all styles
```

## Pattern Fills

Apply gnuplot-style patterns to bar charts:

```python
# Create a bar chart
bars = plt.bar(['A', 'B', 'C'], [1, 2, 3])

# Apply pattern (0-7)
gp.apply_pattern(bars, pattern=1)  # Cross-hatch pattern
```

Available patterns:
- 0: Empty (no fill)
- 1: Cross-hatch
- 2: Dense cross-hatch
- 3: Solid fill
- 4: Diagonal lines (45°)
- 5: Diagonal lines (-45°)
- 6: Wide diagonal lines (45°)
- 7: Wide diagonal lines (-45°)

## Development

### Setup

```bash
# Clone the repository
git clone https://github.com/vectorsss/gnuplot-style.git
cd gnuplot-style

# Install in development mode with all dependencies
pip install -e ".[dev]"

# Install pre-commit hooks
pre-commit install
```

### Running Tests

```bash
# Run all tests
pytest

# Run with coverage
pytest --cov=gnuplot_style

# Generate reference figures
python tests/test_reference_gnuplot_style.py
```

### Code Formatting

The project uses pre-commit hooks to ensure code quality:

```bash
# Run all pre-commit hooks
pre-commit run --all-files

# Or let them run automatically on commit
git commit -m "Your message"
```

## Contributing

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Make your changes
4. Run tests and ensure code quality (`pytest && pre-commit run --all-files`)
5. Commit your changes (`git commit -m 'Add amazing feature'`)
6. Push to the branch (`git push origin feature/amazing-feature`)
7. Open a Pull Request

## Releasing (For Maintainers)

The package is automatically published to PyPI when a GitHub release is created.

### Setup (one-time)

1. Create PyPI API tokens:
   - Go to https://pypi.org/manage/account/token/
   - Create a token for this project
   - Add it as `PYPI_API_TOKEN` in GitHub repository secrets

2. Create TestPyPI API token (optional):
   - Go to https://test.pypi.org/manage/account/token/
   - Create a token for this project
   - Add it as `TEST_PYPI_API_TOKEN` in GitHub repository secrets

### Release Process

1. Update version in `src/gnuplot_style/__init__.py`
2. Create a GitHub release:
   - For pre-releases: Check "Set as pre-release" (publishes to TestPyPI)
   - For production releases: Leave unchecked (publishes to PyPI)

## Acknowledgments

- Inspired by the aesthetic of gnuplot's default terminal
- Built on top of matplotlib's excellent style system

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "gnuplot-style",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "matplotlib, gnuplot, plotting, visualization, style",
    "author": null,
    "author_email": "Chi Zhao <dandanv5@hotmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/55/58/7b4eeac76c6ec6b4fbd79109c21b38644f30c351c1f5a2999fe2e3dd4836/gnuplot_style-0.1.1.tar.gz",
    "platform": null,
    "description": "# gnuplot-style\n\n[![PyPI version](https://badge.fury.io/py/gnuplot-style.svg)](https://badge.fury.io/py/gnuplot-style)\n[![Python versions](https://img.shields.io/pypi/pyversions/gnuplot-style.svg)](https://pypi.org/project/gnuplot-style/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\nA Python package that provides gnuplot-style aesthetics for matplotlib plots.\n\n## Features\n\n- Easy-to-use API for applying gnuplot styles to matplotlib\n- Support for gnuplot's default colors, line styles, markers, and patterns\n- Modular design allowing selective application of styles\n- Compatible with matplotlib's style system\n- Includes pattern fills for histograms and bar charts\n\n## Installation\n\n```bash\npip install gnuplot-style\n```\n\n## Quick Start\n\n```python\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport gnuplot_style as gp\n\n# Apply gnuplot aesthetics BEFORE creating figures\ngp.use()  # Default: colors only\n\n# Create your plots as usual\nx = np.linspace(0, 2*np.pi, 100)\nfor i in range(4):\n    plt.plot(x, np.sin(x + i*0.5), label=f'Series {i+1}')\n\nplt.legend()\nplt.show()\n```\n\n### Note on Axes Created Before Style Application\n\nIf you create axes before calling `gp.use()`, you need to explicitly apply the style:\n\n```python\n# If axes already exist\nfig, ax = plt.subplots()\n\n# Apply style\ngp.use('cl')\n\n# Apply the prop_cycle to existing axes\nax.set_prop_cycle(plt.rcParams['axes.prop_cycle'])\n\n# Now plot with the new style\nax.plot(x, y)\n```\n\n## Style Options\n\nThe package provides several style combinations:\n\n```python\n# Individual components\ngp.use('color')    # or 'c' - Just colors (default)\ngp.use('line')     # or 'l' - Just line styles\ngp.use('marker')   # or 'm' - Just markers\n\n# Combinations\ngp.use('color+line')    # or 'cl' - Colors + line styles\ngp.use('color+marker')  # or 'cm' - Colors + markers\ngp.use('all')          # or 'clm' - Everything combined\n```\n\n### Convenience Functions\n\n```python\ngp.colors()         # Apply colors only\ngp.lines()          # Apply line styles only\ngp.markers()        # Apply markers only\ngp.colors_lines()   # Apply colors + lines\ngp.colors_markers() # Apply colors + markers\ngp.all()           # Apply all styles\n```\n\n## Pattern Fills\n\nApply gnuplot-style patterns to bar charts:\n\n```python\n# Create a bar chart\nbars = plt.bar(['A', 'B', 'C'], [1, 2, 3])\n\n# Apply pattern (0-7)\ngp.apply_pattern(bars, pattern=1)  # Cross-hatch pattern\n```\n\nAvailable patterns:\n- 0: Empty (no fill)\n- 1: Cross-hatch\n- 2: Dense cross-hatch\n- 3: Solid fill\n- 4: Diagonal lines (45\u00b0)\n- 5: Diagonal lines (-45\u00b0)\n- 6: Wide diagonal lines (45\u00b0)\n- 7: Wide diagonal lines (-45\u00b0)\n\n## Development\n\n### Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/vectorsss/gnuplot-style.git\ncd gnuplot-style\n\n# Install in development mode with all dependencies\npip install -e \".[dev]\"\n\n# Install pre-commit hooks\npre-commit install\n```\n\n### Running Tests\n\n```bash\n# Run all tests\npytest\n\n# Run with coverage\npytest --cov=gnuplot_style\n\n# Generate reference figures\npython tests/test_reference_gnuplot_style.py\n```\n\n### Code Formatting\n\nThe project uses pre-commit hooks to ensure code quality:\n\n```bash\n# Run all pre-commit hooks\npre-commit run --all-files\n\n# Or let them run automatically on commit\ngit commit -m \"Your message\"\n```\n\n## Contributing\n\n1. Fork the repository\n2. Create a feature branch (`git checkout -b feature/amazing-feature`)\n3. Make your changes\n4. Run tests and ensure code quality (`pytest && pre-commit run --all-files`)\n5. Commit your changes (`git commit -m 'Add amazing feature'`)\n6. Push to the branch (`git push origin feature/amazing-feature`)\n7. Open a Pull Request\n\n## Releasing (For Maintainers)\n\nThe package is automatically published to PyPI when a GitHub release is created.\n\n### Setup (one-time)\n\n1. Create PyPI API tokens:\n   - Go to https://pypi.org/manage/account/token/\n   - Create a token for this project\n   - Add it as `PYPI_API_TOKEN` in GitHub repository secrets\n\n2. Create TestPyPI API token (optional):\n   - Go to https://test.pypi.org/manage/account/token/\n   - Create a token for this project\n   - Add it as `TEST_PYPI_API_TOKEN` in GitHub repository secrets\n\n### Release Process\n\n1. Update version in `src/gnuplot_style/__init__.py`\n2. Create a GitHub release:\n   - For pre-releases: Check \"Set as pre-release\" (publishes to TestPyPI)\n   - For production releases: Leave unchecked (publishes to PyPI)\n\n## Acknowledgments\n\n- Inspired by the aesthetic of gnuplot's default terminal\n- Built on top of matplotlib's excellent style system\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Gnuplot-style aesthetics for matplotlib",
    "version": "0.1.1",
    "project_urls": {
        "Documentation": "https://github.com/vectorsss/gnuplot-style#readme",
        "Homepage": "https://github.com/vectorsss/gnuplot-style",
        "Issues": "https://github.com/vectorsss/gnuplot-style/issues",
        "Repository": "https://github.com/vectorsss/gnuplot-style"
    },
    "split_keywords": [
        "matplotlib",
        " gnuplot",
        " plotting",
        " visualization",
        " style"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "28fd0028cd9a255d0b3a543a95b7eb5ffc7ee2cecdac88622a3845049e9d48ee",
                "md5": "47a9c8c2eb5641be6230369d93710224",
                "sha256": "dfe79475b43fad4ae873dba775876c1f900a524ee3e4cf9f5ec552cef9d76f6d"
            },
            "downloads": -1,
            "filename": "gnuplot_style-0.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "47a9c8c2eb5641be6230369d93710224",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8960,
            "upload_time": "2025-07-22T22:24:54",
            "upload_time_iso_8601": "2025-07-22T22:24:54.239300Z",
            "url": "https://files.pythonhosted.org/packages/28/fd/0028cd9a255d0b3a543a95b7eb5ffc7ee2cecdac88622a3845049e9d48ee/gnuplot_style-0.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "55587b4eeac76c6ec6b4fbd79109c21b38644f30c351c1f5a2999fe2e3dd4836",
                "md5": "093023a82e1df7c3fc4471fbe2df6685",
                "sha256": "aed9b109cc81ff0a72725581395707c4e663eac84eb9a5269d79feca9d855c20"
            },
            "downloads": -1,
            "filename": "gnuplot_style-0.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "093023a82e1df7c3fc4471fbe2df6685",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 14604,
            "upload_time": "2025-07-22T22:24:54",
            "upload_time_iso_8601": "2025-07-22T22:24:54.990169Z",
            "url": "https://files.pythonhosted.org/packages/55/58/7b4eeac76c6ec6b4fbd79109c21b38644f30c351c1f5a2999fe2e3dd4836/gnuplot_style-0.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-22 22:24:54",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "vectorsss",
    "github_project": "gnuplot-style#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "gnuplot-style"
}
        
Elapsed time: 1.56425s