Skip to content

Commit

Permalink
Add option to flip the longest axis to rows for more readable layout
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaris committed Dec 5, 2024
1 parent 5ad513d commit ddbdf84
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions mira/metamodel/comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,7 @@ def get_concept_comparison_table(
refinement_func: Callable[[str, str], bool] = None,
keep_unmatched: bool = False,
use_full_name: bool = True,
longest_on_rows: bool = False,
) -> pd.DataFrame:
"""Compare two template models by their concepts and return a table
Expand All @@ -896,6 +897,8 @@ def get_concept_comparison_table(
use_full_name :
Use the full name, including top curie and context (if available), of the
concepts in the table. Default: True. If False, use one of display name or name.
longest_on_rows :
If True, switch the longest axis to the rows. Default: False.
Returns
-------
Expand Down Expand Up @@ -946,4 +949,9 @@ def _get_name_from_concept(concept: Concept) -> str:
data[name1][name2] = ""
table = pd.DataFrame(data)
table.fillna("", inplace=True)

# Transpose if len(rows) < len(columns)
if longest_on_rows and table.shape[0] < table.shape[1]:
table = table.T

return table

0 comments on commit ddbdf84

Please sign in to comment.