StatsPack is a Python package designed for statistical visualization. It provides functions to create density contour plots, confidence intervals, and other statistical visualizations directly related with percentiles of 2D distributions. It was specially desined to be lightweight and avoid memory overusage.
Python3.8+
numpy
scipy
matplotlib
colorlog
logging
datetime
You can install the StatsPack package using pip:
pip install statspack
Import the package in your Python code
import statspackimport numpy as np
import matplotlib.pyplot as plt
# Example data
x = np.random.rand(100)
y = np.random.rand(100)
z = np.random.rand(100)
# Create contour plot data
X, Y, Z = statspack.bining(x, y, z, nbins=10, xlim=(None, None), ylim=(None, None))
# Plot the contour
plt.contour(X, Y, Z)
plt.colorbar()
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Contour Plot')
plt.show()import numpy as np
# Example PDF data
hist_pdf = np.random.rand(100)
# Find confidence interval
confidence_interval = statspack.find_confidence_interval(hist_pdf, prc=0.95)
print(f"95% Confidence Interval: {confidence_interval}")import numpy as np
import matplotlib.pyplot as plt
# Example data
xdata = np.random.rand(100)
ydata = np.random.rand(100)
binsx = 10
binsy = 10
# Create density contour plot
contours, levels = statspack.density_contour(xdata, ydata, binsx, binsy, verbose=True)
plt.colorbar(contours[0], label='Density')
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Density Contour Plot')
plt.show()import numpy as np
import matplotlib.pyplot as plt
# Example data
x_axis = np.random.rand(100)
y_axis = np.random.rand(100)
# Create contour PDF plot
contours = statspack.contour_pdf(x_axis, y_axis, nbins=10, percent=[10, 50, 90], colors=['blue', 'green', 'red'])
plt.xlabel('X-axis')
plt.ylabel('Y-axis')
plt.title('Contour PDF Plot')
plt.show()These are some of the functions provided by the StatsPack package for statistical visualization. You can refer to the function documentation in the source code for more details on their parameters and usage.
StatsPack is licensed under the GNU General Public License v3.0. You can find the full text of the license in the LICENSE file included with the package.