Skip to content

Commit

Permalink
Fixed error in drawing last label
Browse files Browse the repository at this point in the history
  • Loading branch information
LucaCappelletti94 committed Feb 29, 2020
1 parent b507263 commit 7be4466
Show file tree
Hide file tree
Showing 18 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions barplots/utils/text_positions.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def text_positions(df: pd.DataFrame, bar_width: float, index_level: int) -> Gene
yield text_position/2 + bar_width/2, old_index[j]
if j == index_level and j == len(jumps)-1 and is_last(df, i):
yield text_position/2 + bar_width*1.5, index[j]
if index_level==0 and is_last(df, i):
yield text_position/2, index[index_level]
old_index = index
for j, value in enumerate(jumps):
if value:
Expand Down
Binary file modified examples/horizontal_legend_minor_rotation_val_auroc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/horizontal_legend_subplots_minor_rotation_val_auroc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/horizontal_major_rotation_val_auroc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/horizontal_subplots_major_rotation_val_auroc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/vertical_legend_subplots_val_auroc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/vertical_legend_val_auroc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/vertical_minor_rotation_val_auroc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified examples/vertical_subplots_minor_rotation_val_auroc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified test_barplots/val_auroc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions tests/test_simple_barplots.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import pandas as pd
from barplots import barplots


def test_simple_barplots():
root = "test_barplots"
df = pd.read_csv("tests/test_case.csv")

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

barplots(
df,
["cell_line", "task", "model"],
path="{root}/{{feature}}.png".format(root=root),
orientation="horizontal",
verbose=False,
custom_defaults=custom_defaults,
subplots=True
)
13 changes: 13 additions & 0 deletions tests/test_single.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pandas as pd
from barplots import barplots


def test_single_index():
root = "test_barplots"
df = pd.read_csv("tests/test_case.csv")
barplots(
df,
["cell_line"],
path="{root}/{{feature}}.png".format(root=root),
verbose=False
)

0 comments on commit 7be4466

Please sign in to comment.