A better looking star marker for matplotlib plots.
Project description
betterstar
A python package that implements a better looking star for matplotlib plots.
About this package
This package allows you to integrate a more professionally looking star into your matplotlib plots.
The upper star is the standard matplotlib star. The lower one is the one you get with this package.
Setup
pip install betterstar
Quick Usage Example
from betterstar import star
import matplotlib.pyplot as plt
# some code
p33 = plt.plot(x3[i3], min3, marker=star, color='c', markersize=6, markeredgewidth=0.35)
# some more code
Advanced example
If you need a professional look to your plots, you can use the following code example. This way you will use a LaTeX rendered font.
# Initial plot setup
figure2 = plt.figure(figsize=(10.0,5.0),dpi=150)
axes2 = plt.subplot(1, 1, 1)
axes2.spines[['right', 'top']].set_visible(False)
axes2.tick_params(direction="in", width=0.5)
plt.xlim([80, 175])
plt.ylim([0.5, 1.5])
# Change tick frequency
locy = plticker.MultipleLocator(base=0.1)
axes2.yaxis.set_major_locator(locy)
locx = plticker.MultipleLocator(base=10.0)
axes2.xaxis.set_major_locator(locx)
# Remove Tick at origin
xticks = axes2.xaxis.get_major_ticks()
xticks[1].tick1line.set_visible(False)
yticks = axes2.yaxis.get_major_ticks()
yticks[1].tick1line.set_visible(False)
# Title and axes
hT = plt.title(r'\boldmath$\frac{P}{v_\mathrm{TAS}}$ $\textbf{\textrm{\"{u}ber}}$ $v_\mathrm{TAS}$') # Title
hT.set_fontsize(16)
plt.xlabel(r'$v_\mathrm{TAS}$ $\left[\mathrm{kt}\right]$', fontsize=12) # x-axis label
plt.ylabel(r'$\frac{P}{v_\mathrm{TAS}}$ $\left[\frac{\mathrm{hp}}{\mathrm{kt}}\right]$', fontsize=12) # y-axis label
# Plot the first line
p11 = plt.plot(v_tas_b, ppv2,'ms', markersize=1)
plt.plot(x2,y2,'g',linewidth=0.5)
p22 = plt.plot(x2[i2],min2, marker=mlab_star, color='c', markersize=6, markeredgewidth=0.35)
# Plot second line
p12 = plt.plot(v_tas, ppv,'bs', markersize=1) # r for red, s for square
plt.plot(x1,y1,'r',linewidth=0.5)
p21 = plt.plot(x1[i1],min1, marker=mlab_star, color='y', markersize=6, markeredgewidth=0.35)
# Text at lowest point of line
plt.text(x1[i1]-2,min1+0.05, f'$\mathrm{{{round(min1,2)}}}$' + r'$\frac{\mathrm{hp}}{\mathrm{kt}}$')
plt.text(x2[i2],min2-0.05, f'$\mathrm{{{str(round(min2,2))}}}$' + r'$\frac{\mathrm{hp}}{\mathrm{kt}}$')
# Legend
legend = plt.legend([p11[0], p12[0], p21[0], p22[0]], [r'$\frac{P}{v_\mathrm{TAS}}$', r'$\frac{P}{v_\mathrm{TAS}}$ \textrm{berechnet}', r'\textrm{minimum}', r'\textrm{minimum}'], loc='upper right', handlelength=0)
frame = legend.get_frame()
frame.set_edgecolor('black')
frame.set_linewidth(0.5)
This will result in a plot like this:
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file betterstar-1.0.2.tar.gz.
File metadata
- Download URL: betterstar-1.0.2.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3282bebbbdf4114da53edcc4ee5b31d31425ea55ee70893ac539bab6c380c541
|
|
| MD5 |
8a948f6c7a8fb2d49096e8cb9f26ba37
|
|
| BLAKE2b-256 |
3d700cb80b8a37274109cd77f2b5fc62a3952bf0baa3041e3f3d7ac4793745c6
|
File details
Details for the file betterstar-1.0.2-py3-none-any.whl.
File metadata
- Download URL: betterstar-1.0.2-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.9.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b5daf4996d4208216201ea9b5f87ce692ea11be08ea64e3424feff065d7f823
|
|
| MD5 |
5bae7ec521866db5de8ef1ef6917ec2d
|
|
| BLAKE2b-256 |
fbb8c42f88b387b5715e9b1894c5984a236e531c2d44377126605460b28e8d79
|