barplots

Python package to easily make barplots from multi-indexed dataframes.

https://github.com/LucaCappelletti94/barplots

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.5%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

Python package to easily make barplots from multi-indexed dataframes.

Basic Info
  • Host: GitHub
  • Owner: LucaCappelletti94
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 95.2 MB
Statistics
  • Stars: 7
  • Watchers: 1
  • Forks: 2
  • Open Issues: 1
  • Releases: 1
Created over 6 years ago · Last pushed over 1 year ago
Metadata Files
Readme Funding License

README.md

Barplots

pip downloads License CI

Python package to easily make barplots from multi-indexed dataframes.

How do I install this package?

As usual, just download it using pip:

shell pip install barplots

Documentation

Most methods, in particular those exposed to user usage, are provided with docstrings. Consider reading these docstrings to learn about the most recent updates to the library.

Examples of the DataFrame structure

The dataframe to be provided to the barplots library may look like the following:

| missrate | fallout | mcc | evaluationtype | unbalance | graphname | normalization_name | |------------|----------|-----------|-----------------|-----------|----------------------------|--------------------| | 0.0332031 | 0.705078 | 0.353357 | train | 10 | AlligatorSinensis | Traditional | | 0.240234 | 0.478516 | 0.289591 | train | 1 | CanisLupus | Right Laplacian | | 0.0253906 | 0.931641 | 0.101643 | train | 100 | AlligatorSinensis | Right Laplacian | | 0.121094 | 0.699219 | 0.220219 | train | 10 | HomoSapiens | Traditional | | 0.0136719 | 0.292969 | 0.722095 | test | 1 | CanisLupus | Right Laplacian | | 0.0605469 | 0.90625 | 0.0622185 | test | 10 | AmanitaMuscariaKoideBx008 | Traditional | | 0.0078125 | 0.4375 | 0.614287 | train | 100 | AmanitaMuscariaKoideBx008 | Traditional | | 0.171875 | 0.869141 | -0.0572194| train | 100 | AlligatorSinensis | Traditional | | 0.0859375 | 0.810547 | 0.150206 | train | 10 | MusMusculus | Right Laplacian | | 0.0273438 | 0.646484 | 0.415357 | test | 10 | MusMusculus | Right Laplacian |

Specifically, in this example, we may create bar plots for the features Miss rate, fallout, and Matthew Correlation Coefficient by grouping on the evaluation_type, unbalance, graph_name, and normalization_name columns.

An example CSV file can be seen here.

Usage examples

Here follows a set of examples of common usages. Basically, every graph shows either the same data or a mean based on the provided group by indices. Choose whatever representation is best for visualizing your data, as one is not necessarily better than another for every dataset.

Note: The data used in the following examples are randomly generated for testing purposes. DO NOT consider these values as valid results for experiments using the same labels (cell lines, etc.), which are only used to show possible usages.

For every example, the considered dataframe df is loaded as follows:

```python import pandas as pd

df = pd.readcsv("tests/testcase.csv") ```

Also, for every example, the custom_defaults used to sanitize the labels specific to the dataset is:

python custom_defaults = { "P": "promoters", "E": "enhancers", "A": "active ", "I": "inactive ", "+": " and ", "": "anything", "Validation": "val" }

Horizontal Example A

In the following example, we will plot the bars horizontally, rotating the group labels by 90 degrees, and displaying the bar labels as a shared legend.

```python from barplots import barplots import pandas as pd

df = pd.readcsv("tests/testcase.csv") custom_defaults = { "P": "promoters", "E": "enhancers", "A": "active ", "I": "inactive ", "+": " and ", "": "anything", "Validation": "val" }

barplots( df, groupby=["task", "model"], orientation="horizontal", showlegend=True, minorrotation=90, customdefaults=customdefaults ) ```

Result can be seen here.

Horizontal Example B

In this example, we will plot the top index as multiple subplots with horizontal bars, rotating the group labels by 90 degrees, and displaying the bar labels as a shared legend.

```python from barplots import barplots import pandas as pd

df = pd.readcsv("tests/testcase.csv") custom_defaults = { "P": "promoters", "E": "enhancers", "A": "active ", "I": "inactive ", "+": " and ", "": "anything", "Validation": "val" }

barplots( df, groupby=["cellline", "task", "model"], orientation="horizontal", showlegend=True, subplots=True, minorrotation=90, customdefaults=custom_defaults ) ```

Horizontal Example B

Horizontal Example C

In this example, we will plot horizontal bars, rotating the top group labels by 90 degrees, and displaying the bar labels as minor ticks.

```python from barplots import barplots import pandas as pd

df = pd.readcsv("tests/testcase.csv") custom_defaults = { "P": "promoters", "E": "enhancers", "A": "active ", "I": "inactive ", "+": " and ", "": "anything", "Validation": "val" }

barplots( df, groupby=["task", "model"], orientation="horizontal", showlegend=False, majorrotation=90, customdefaults=customdefaults ) ```

Result can be seen here.

Horizontal Example D

In this example, we will plot the top index as multiple subplots with horizontal bars, rotating the group labels by 90 degrees, and displaying the bar labels as minor ticks.

```python from barplots import barplots import pandas as pd

df = pd.readcsv("tests/testcase.csv") custom_defaults = { "P": "promoters", "E": "enhancers", "A": "active ", "I": "inactive ", "+": " and ", "": "anything", "Validation": "val" }

barplots( df, groupby=["cellline", "task", "model"], orientation="horizontal", showlegend=False, majorrotation=90, subplots=True, customdefaults=custom_defaults ) ```

Horizontal Example D

Vertical Example A

In this example, we will plot the bars vertically and display the bar labels as a shared legend.

```python from barplots import barplots import pandas as pd

df = pd.readcsv("tests/testcase.csv") custom_defaults = { "P": "promoters", "E": "enhancers", "A": "active ", "I": "inactive ", "+": " and ", "": "anything", "Validation": "val" }

barplots( df, groupby=["task", "model"], orientation="vertical", showlegend=True, customdefaults=custom_defaults ) ```

Result can be seen here.

Vertical Example B

In this example, we will plot the top index as multiple subplots with vertical bars, displaying the bar labels as a shared legend.

```python from barplots import barplots import pandas as pd

df = pd.readcsv("tests/testcase.csv") custom_defaults = { "P": "promoters", "E": "enhancers", "A": "active ", "I": "inactive ", "+": " and ", "": "anything", "Validation": "val" }

barplots( df, groupby=["cellline", "task", "model"], orientation="vertical", showlegend=True, subplots=True, customdefaults=customdefaults ) ```

Vertical Example B

Vertical Example C

In this example, we will plot vertical bars, rotating the minor group labels by 90 degrees, and displaying the bar labels as minor ticks.

```python from barplots import barplots import pandas as pd

df = pd.readcsv("tests/testcase.csv") custom_defaults = { "P": "promoters", "E": "enhancers", "A": "active ", "I": "inactive ", "+": " and ", "": "anything", "Validation": "val" }

barplots( df, groupby=["task", "model"], orientation="vertical", showlegend=False, minorrotation=90, customdefaults=customdefaults ) ```

Result can be seen here.

Vertical Example D

In this example, we will plot the top index as multiple subplots with vertical bars, rotating the minor group labels by 90 degrees, and displaying the bar labels as minor ticks.

```python from barplots import barplots import pandas as pd

df = pd.readcsv("tests/testcase.csv") custom_defaults = { "P": "promoters", "E": "enhancers", "A": "active ", "I": "inactive ", "+": " and ", "": "anything", "Validation": "val" }

barplots( df, groupby=["cellline", "task", "model"], orientation="vertical", showlegend=False, minorrotation=90, subplots=True, customdefaults=custom_defaults ) ```

Vertical Example D

Owner

  • Name: Luca Cappelletti
  • Login: LucaCappelletti94
  • Kind: user
  • Location: Milano, Italy
  • Company: University of Fribourg

I am but an egg 🥚 - "Stranger in a Strange Land"

GitHub Events

Total
  • Push event: 4
Last Year
  • Push event: 4

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 293
  • Total Committers: 2
  • Avg Commits per committer: 146.5
  • Development Distribution Score (DDS): 0.003
Past Year
  • Commits: 20
  • Committers: 1
  • Avg Commits per committer: 20.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
LucaCappelletti94 c****4@g****m 292
Tommaso Fontana t****6@g****m 1

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 1
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 1
  • Total pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • LucaCappelletti94 (1)
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 53 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 4
  • Total versions: 28
  • Total maintainers: 1
pypi.org: barplots

Python package to easily make barplots from multi-indexed dataframes.

  • Versions: 28
  • Dependent Packages: 0
  • Dependent Repositories: 4
  • Downloads: 53 Last month
Rankings
Dependent repos count: 7.5%
Dependent packages count: 10.1%
Average: 16.4%
Forks count: 19.1%
Stargazers count: 19.3%
Downloads: 25.8%
Maintainers (1)
Last synced: 12 months ago

Dependencies

setup.py pypi
  • humanize *
  • matplotlib >=3.5.2
  • pandas *
  • pillow *
  • sanitize_ml_labels >=1.0.41
  • scipy *
  • tqdm *
.github/workflows/python.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite