Skip to main content

A package for consistent journal-ready matplotlib plotting styles

Project description

JournalPlots

A Python package for creating publication-ready matplotlib figures with consistent styling. Designed to make your scientific visualizations look professional and meet journal requirements.

Features

  • 🎨 Colorblind-friendly color palettes
  • 📏 Journal-appropriate font sizes and styles
  • 🖼️ High-resolution output settings (300 DPI)
  • 🎯 Easy-to-use styling functions
  • 📐 Consistent figure dimensions

Installation

You can install the package directly from source:

git clone https://github.com/joemans3/journalplots.git
cd journalplots
pip install .

or use PyPI package:

pip install JournalPlots

Usage

Basic Usage

import matplotlib.pyplot as plt
from journalplots import set_style, apply_style, cb_colors

# Set the global style
set_style(font_scale=1.0)

# Create your plot
fig, ax = plt.subplots()
ax.plot([1, 2, 3], [1, 2, 3], color=cb_colors()['red'], label='Data')
apply_style(ax, title='My Plot', xlabel='X', ylabel='Y')
plt.show()

Available Colors

The package includes a colorblind-friendly palette:

from journalplots import cb_colors

red = cb_colors()['red']

# Available colors:
# - COLORBLIND_COLORS = {
# -    "blue": "#377eb8",
# -    "orange": "#ff7f00",
# -    "green": "#4daf4a",
# -    "pink": "#f781bf",
# -    "brown": "#a65628",
# -    "purple": "#984ea3",
# -    "gray": "#999999",
# -    "red": "#e41a1c",
# -    "yellow": "#dede00",
# }

# Using set_style, subsequent plots cycle through these colorblind colors rather than the Pyplot defaults.

Customizing Sizes

You can adjust various size parameters:

from journalplots import SIZES

# Available size presets:
# - SIZES['figure']       # Default figure size in inches
# - SIZES['font']         # Font sizes (tiny, small, medium, large, xlarge)
# - SIZES['linewidth']    # Default line width
# - SIZES['markersize']   # Default marker size
# - SIZES['tick_length']  # Length of axis ticks

Style Functions

set_style()

Sets global matplotlib parameters for consistent styling:

set_style(font_scale=1.0)  # Adjust font_scale to make all text larger or smaller

apply_style()

Apply styling to a specific axes object:

apply_style(ax,
           title='My Plot',     # Optional plot title
           xlabel='X',          # Optional x-axis label
           ylabel='Y',          # Optional y-axis label
           legend=True)         # Whether to show legend

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

journalplots-0.1.21.tar.gz (83.2 kB view details)

Uploaded Source

Built Distribution

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

journalplots-0.1.21-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file journalplots-0.1.21.tar.gz.

File metadata

  • Download URL: journalplots-0.1.21.tar.gz
  • Upload date:
  • Size: 83.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for journalplots-0.1.21.tar.gz
Algorithm Hash digest
SHA256 a072ee57d54b043b5e6782c65190080296e5415fb758adb6629c2d1b209a99d2
MD5 dc305d896d14c4af61de9e119d9a7c15
BLAKE2b-256 a81e6b0e6b70139eea9545b5bbefffda4897a3092eaf7e8074e1f851b1b3f78e

See more details on using hashes here.

Provenance

The following attestation bundles were made for journalplots-0.1.21.tar.gz:

Publisher: publishpypi.yml on joemans3/JournalPlots

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

File details

Details for the file journalplots-0.1.21-py3-none-any.whl.

File metadata

  • Download URL: journalplots-0.1.21-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for journalplots-0.1.21-py3-none-any.whl
Algorithm Hash digest
SHA256 fed6b699534f97bfe9d0063f6d1fda817781ed283bbc164235ab105209d4556f
MD5 c2cccfc380fb7d7c011ccf59a38a388b
BLAKE2b-256 33298ea5cfd601cd94faa4e79431eefa000d9923fe5c038401524e320e84abee

See more details on using hashes here.

Provenance

The following attestation bundles were made for journalplots-0.1.21-py3-none-any.whl:

Publisher: publishpypi.yml on joemans3/JournalPlots

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