A custom Matplotlib theme using the Poppins font styled like ggplot.
Project description
Matplotlib Poppins Theme (Inspired by ggplot)
This package provides a custom theme for Matplotlib, inspired by the visual style of ggplot, using the Poppins font for a clean and modern look.
Features
- Custom Matplotlib theme with the Poppins font.
- Configurable options for title size, label size, boldness, and grid display.
- Inspired by ggplot2's elegant styling.
Installation
You can install this package via pip:
pip install finres_ggpt2_matplotlib
Usage
import finres_ggpt2_matplotlib
# Apply the custom Poppins theme
finres_ggpt2_matplotlib.set_poppins_theme()
# Now create your plots
import matplotlib.pyplot as plt
x = [1, 2, 3, 4, 5]
y = [10, 15, 13, 17, 18]
plt.plot(x, y)
plt.title("Sample Poppins Plot")
plt.show()
Customization Options
You can customize the theme by passing different options to set_poppins_theme():
# Apply the Poppins theme with custom options
matplotlib_poppins_theme.set_poppins_theme(
title_size=18, # Custom title size
label_size=14, # Custom label size
bold_title=True, # Bold titles
bold_labels=False, # Non-bold axis labels
show_grid=True # Show grid lines
)
import matplotlib.pyplot as plt
import numpy as np
categories = ['Category A', 'Category B', 'Category C', 'Category D']
x = np.linspace(0, 10, 100) # Shared x-axis for all plots
data = {category: np.sin(x + i) for i, category in enumerate(categories)} # Different sine waves for each category
# Create a figure and axes for the faceted plot (2 rows, 2 columns)
fig, axes = plt.subplots(2, 2, figsize=(10, 8)) # Create a 2x2 grid of subplots
axes = axes.flatten() # Flatten axes for easy iteration
# Iterate through each axis and plot the corresponding data
for ax, (category, y) in zip(axes, data.items()):
ax.plot(x, y, label=category, color=np.random.rand(3,))
ax.set_title(f"Facet: {category}", fontsize=12, weight='bold') # Set the title for each facet
ax.set_xlabel('X-axis')
ax.set_ylabel('Y-axis')
ax.legend()
# Adjust layout for better spacing
plt.tight_layout()
# Show the faceted plot
plt.show()
with the theme
Parameters:
title_size
: Sets the font size for the plot title (default is 14).label_size
: Sets the font size for the axis labels (default is 12).bold_title
: Boolean to specify if the title should be bold (default isTrue
).bold_labels
: Boolean to specify if the axis labels should be bold (default isTrue
).show_grid
: Boolean to specify if the grid should be shown (default isFalse
).
Contributing
Contributions are welcome! Feel free to submit a pull request or open an issue on GitHub.
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
Built Distribution
File details
Details for the file finres_ggpt2_matplotlib-0.3.0.tar.gz
.
File metadata
- Download URL: finres_ggpt2_matplotlib-0.3.0.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6380e7e13b375d3089e8987ecf44063558ff92f514b91f54e23eef18cf1b232 |
|
MD5 | 32b9b21c72fa9f7da42a50211896236c |
|
BLAKE2b-256 | 2a63a6a2427f587106f161fc0d171da480203926d8e9de7c4935e7086b856924 |
File details
Details for the file finres_ggpt2_matplotlib-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: finres_ggpt2_matplotlib-0.3.0-py3-none-any.whl
- Upload date:
- Size: 1.4 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d899e5496630e25a4d81ed8a4e7fc831e9dfc1477747ccc66d8ac1f2d18ec48 |
|
MD5 | 296be99c9f9effa3bd9ea40da54dbd5a |
|
BLAKE2b-256 | 22776f8d01251ee03dfa3e66abf27096ab152d6a7ff2a9ed9d32bb9df8b24ac9 |