Skip to content

Commit 5e6f3a9

Browse files
authored
Reject legend_loc='on data' loudly in pl.show() (#649)
1 parent 9be9156 commit 5e6f3a9

2 files changed

Lines changed: 3 additions & 6 deletions

File tree

src/spatialdata_plot/pl/basic.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,6 +1147,9 @@ def show(
11471147
legend_fontoutline = legend_params.get("fontoutline", legend_fontoutline)
11481148
na_in_legend = legend_params.get("na_in_legend", na_in_legend)
11491149

1150+
if legend_loc == "on data":
1151+
raise ValueError("legend_loc='on data' is not supported in spatialdata-plot.")
1152+
11501153
legend_params_obj = LegendParams(
11511154
legend_fontsize=legend_fontsize,
11521155
legend_fontweight=legend_fontweight,

src/spatialdata_plot/pl/render.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,12 +1153,6 @@ def _draw_channel_legend(
11531153
palette_dict[entry.channel_name] = entry.color_hex
11541154

11551155
legend_loc = legend_params.legend_loc
1156-
if legend_loc == "on data":
1157-
logger.warning(
1158-
"legend_loc='on data' is not supported for channel legends (no scatter coordinates); "
1159-
"falling back to 'right margin'."
1160-
)
1161-
legend_loc = "right margin"
11621156

11631157
categories = pd.Categorical(list(palette_dict))
11641158

0 commit comments

Comments
 (0)