Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding arbitrary legend_columns for python-backends #4678

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added legend_columns also for deprecated pyplot for consistency
  • Loading branch information
briederer committed Mar 3, 2023
commit b974f14f63bd890a6c431f1bf58ec6eab65557bd
12 changes: 7 additions & 5 deletions src/backends/deprecated/pyplot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1527,14 +1527,16 @@ function py_add_legend(plt::Plot, sp::Subplot, ax)
# if anything was added, call ax.legend and set the colors
if !isempty(handles)
leg = legend_angle(leg)
ncol = if (lc = sp[:legend_column]) < 0
ncol = if (lc = sp[:legend_column]) == -1
nseries
elseif lc > 1
lc == nseries ||
@warn "n° of legend_column=$lc is not compatible with n° of series=$nseries"
elseif lc > nseries
@warn "n° of legend_column=$lc is larger than n° of series=$nseries"
nseries
else
elseif lc == 0 || lc < -1
@warn "n° of legend_column=$lc has undefined behaviour. Assuming vertical layout."
1
else
lc
end
leg = ax."legend"(
handles,
Expand Down