Skip to content

Commit

Permalink
Merge pull request #51 from geoneric/gh42
Browse files Browse the repository at this point in the history
Make sure horizontal lines don't overlap
  • Loading branch information
kordejong authored Dec 13, 2024
2 parents a8e410f + 53b4cbc commit 558ac0e
Show file tree
Hide file tree
Showing 6 changed files with 453 additions and 130 deletions.
20 changes: 17 additions & 3 deletions source/package/adaptation_pathways/cli/plot_pathway_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def plot_map(
plot_pathname: str,
*,
arguments,
legend_arguments,
) -> int:

# pylint: disable-next=unused-variable
Expand All @@ -45,7 +46,9 @@ def plot_map(
# TODO This should be colour_by_action
arguments["colour_by_action_name"] = colour_by_action_name

plot_classic_pathway_map(axes, pathway_map, arguments=arguments)
plot_classic_pathway_map(
axes, pathway_map, arguments=arguments, legend_arguments=legend_arguments
)
save_plot(plot_pathname)

return 0
Expand Down Expand Up @@ -77,7 +80,7 @@ def main() -> int:
--spread=<spread> Separate overlapping lines by a percentage [0, 1] of
the range passed in. A value of 0.01 means 1% of the
range of x-coordinates. Passing in a value > 0.02 is
likely not useful.
likely not useful. [default: 0]
--title=<title> Title
--x_label=<label> Label of x-axis
Expand Down Expand Up @@ -112,4 +115,15 @@ def main() -> int:
if len(os.path.splitext(plot_pathname)[1]) == 0:
plot_pathname += ".pdf"

return plot_map(basename_pathname, plot_pathname, arguments=plot_arguments)
# https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.legend.html#matplotlib.axes.Axes.legend
legend_arguments = {
"framealpha": 0.2,
"fancybox": False,
}

return plot_map(
basename_pathname,
plot_pathname,
arguments=plot_arguments,
legend_arguments=legend_arguments,
)
2 changes: 2 additions & 0 deletions source/package/adaptation_pathways/plot/alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@

ColourByAction = dict[Action, Colour]
ColourByActionName = dict[str, Colour]

Region = tuple[float, float]
Loading

0 comments on commit 558ac0e

Please sign in to comment.