fortplot_legend_best Module

Resolve matplotlib 'best' legend placement against the plotted artists.

Single Responsibility: collect artist sample points in data coordinates and delegate corner selection to fortplot_legend_layout. Kept separate from rendering so the layout module stays free of plot_data_t.



Subroutines

public subroutine resolve_best_legend_position(legend, plots, plot_count, x_min, x_max, y_min, y_max, pixel_plot_width, pixel_plot_height)

If the legend is in 'best' mode, pick the lowest-overlap corner and pin the legend to it. Coordinates passed to the scorer are relative to the data window origin (x_min, y_min), matching the layout module.

Arguments

Type IntentOptional Attributes Name
type(legend_t), intent(inout) :: legend
type(plot_data_t), intent(in) :: plots(:)
integer, intent(in) :: plot_count
real(kind=wp), intent(in) :: x_min
real(kind=wp), intent(in) :: x_max
real(kind=wp), intent(in) :: y_min
real(kind=wp), intent(in) :: y_max
integer, intent(in) :: pixel_plot_width
integer, intent(in) :: pixel_plot_height