diff --git a/src/spatialdata_plot/pl/basic.py b/src/spatialdata_plot/pl/basic.py index 8a7c2ec5..02d6dc51 100644 --- a/src/spatialdata_plot/pl/basic.py +++ b/src/spatialdata_plot/pl/basic.py @@ -1147,6 +1147,9 @@ def show( legend_fontoutline = legend_params.get("fontoutline", legend_fontoutline) na_in_legend = legend_params.get("na_in_legend", na_in_legend) + if legend_loc == "on data": + raise ValueError("legend_loc='on data' is not supported in spatialdata-plot.") + legend_params_obj = LegendParams( legend_fontsize=legend_fontsize, legend_fontweight=legend_fontweight, diff --git a/src/spatialdata_plot/pl/render.py b/src/spatialdata_plot/pl/render.py index 6a5bfc8c..7e1b8073 100644 --- a/src/spatialdata_plot/pl/render.py +++ b/src/spatialdata_plot/pl/render.py @@ -1153,12 +1153,6 @@ def _draw_channel_legend( palette_dict[entry.channel_name] = entry.color_hex legend_loc = legend_params.legend_loc - if legend_loc == "on data": - logger.warning( - "legend_loc='on data' is not supported for channel legends (no scatter coordinates); " - "falling back to 'right margin'." - ) - legend_loc = "right margin" categories = pd.Categorical(list(palette_dict))