Baycomp Plotting
The baycomp_plotting is a python package for building good-looking plots of bayesian posteriors obtained with baycomp.
This package could be useful for scientific purposes, specially in the area of Machine Learning.
Author
- Mario Juez-Gil <mariojg@ubu.es>
Department of Computer Science
Universidad de Burgos
ADMIRABLE Research Group
Installation
This package can be installed using PIP.
pip install baycomp_plotting
Basic Usage
The package can be imported as follows:
import baycomp_plotting as bplt
Two plotting functions (tern, and dens), and one class with four matplotlib alternative colors (Color) are provided.
Colors
Four alternative colors to default matplotlib colors are provided:
Example:
import baycomp_plotting as bplt
print(bplt.Color.BLUE)
Output:
'#008ece'
Density plots
For plotting the comparison of two classifiers on a single dataset, dens function could be used. It's parameters are the following:
p: baycomp posterior.label: label of the density function.ls: line style (use a matplotlib line style) [default:-]color: density function color [default:Color.BLUE]
Example:
import baycomp_plotting as bplt
import baycomp as bc
posterior = bc.CorrelatedTTest(left_classifier_acc, right_classifier_acc, rope=0.01)
fig = bplt.dens(posterior, label='C1', ls='-', color=bplt.Color.BLUE)
Output:
The output figure will have a new function named add_posterior so you can add more posteriors to the figure. The parameters are the same as for dens.
Example:
import baycomp_plotting as bplt
import baycomp as bc
posterior = bc.CorrelatedTTest(left_classifier_1_acc, right_classifier_acc, rope=0.01)
posterior_1 = bc.CorrelatedTTest(left_classifier_2_acc, right_classifier_acc, rope=0.01)
fig = bplt.dens(posterior, label='C1', ls='-', color=bplt.Color.BLUE)
fig.add_posterior(posterior_1, label='C2', ls=(0,(5,1)), color=bplt.Color.GRAY)
fig.legend() # you can show the legend
Output:
Ternary plots
For plotting the comparison of two classifiers on multiple datasets using a ternary plot, tern function could be used. It's parameters are the following:
p: baycomp posterior.names: an array containing Left and Right region labels. [default:["L", "R"]]
Example:
import baycomp_plotting as bplt
import baycomp as bc
posterior = bc.HierarchicalTest(left_classifier_acc, right_classifier_acc, rope=0.01)
fig = bplt.tern(posterior)
Output:
Comparison against baycomp default plots
Density:
Ternary:
Contribute
Feel free to submit any pull requests 😊
Acknowlegments
This work was supported by the pre-doctoral grant (EDU/1100/2017) of the Consejería de Educación of the Junta de Castilla y León, Spain, and the European Social Fund.
License
This work is licensed under GNU GPL v3.
Citation policy
Please, cite this work as:
@software{baycomp_plotting,
author = {Mario Juez-Gil},
title = {{mjuez/baycomp_plotting}},
month = nov,
year = 2020,
publisher = {Zenodo},
version = {v1.0},
doi = {10.5281/zenodo.4244542},
url = {https://doi.org/10.5281/zenodo.4244542}
}
Metadata
Release files for baycomp-plotting 1.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| baycomp_plotting-1.2.1.tar.gz | 111.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| baycomp_plotting-1.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 143.2 kB
Release files / baycomp_plotting-1.2.1.tar.gz
| Download URL | baycomp_plotting-1.2.1.tar.gz |
|---|---|
| Size | 111.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
98251e0606348d29d77547cb52100003afc9e1c06c6f90629a2b054dbb92e290
|
|
BLAKE2b-256 checksum How to use checksums |
46d7210f19705bf1989709429a900f648f95dae1e0edecc38768c9322b29bc26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 4, 2026.
Transparency logRelease files / baycomp_plotting-1.2.1-py3-none-any.whl
| Download URL | baycomp_plotting-1.2.1-py3-none-any.whl |
|---|---|
| Size | 31.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4564e0a76d224becef164a6b303cae516b3b1680248286cb69e16b1ee6e2fdda
|
|
BLAKE2b-256 checksum How to use checksums |
4349c8686f2f4c924a00992864f4e4c64aa019b75c1dca7d877f7e9149cf4a9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 4, 2026.
Transparency log