# Positioning of legend, Version 2025.0.0

**URL:** <https://scilab.discourse.group/t/positioning-of-legend-version-2025-0-0/914>\
**Category:** Graphics and plotting\
**Created:** [April 21, 2025, 10:21am UTC](https://scilab.discourse.group/t/positioning-of-legend-version-2025-0-0/914 "2025-04-21T10:21:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jens](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jens](https://scilab.discourse.group/u/Jens)\
**Post date:** [April 21, 2025, 10:21am UTC](https://scilab.discourse.group/t/positioning-of-legend-version-2025-0-0/914/1 "2025-04-21T10:21:52Z")

</div>

Given a plot command under subplot - with rendering by isoview, data\_bounds, tight\_limits, and xtitle - the positioning of legend by axes coordinates seems to be disturbed. The documentation recommended way

> as=get(gcf(),“axes\_size”);//size of the canvas in pixels  
> bnds=get(gca(),“axes\_bounds”);//bounds of the current axes rectangle in figure size ratio.  
> //from user coordinates to legend coordinates  
> [x1,y1]=xchange(x\_user,y\_user,‘f2i’)  
> position=[(x1-as(1)\*bnds(1))/(as(1)\*bnds(3)),…  
> (y1-as(2)\*bnds(2))/(as(2)\*bnds(4))];

is not effective, whereby I understand position as the input coordinates for legend. The legend command is inserted as the last one acting on the subplot.  
What can I do better?

---

<div class="post-metadata">

**Author:** ![cfuttrup](https://avatars.discourse-cdn.com/v4/letter/c/3ec8ea/32.png) [@cfuttrup](https://scilab.discourse.group/u/cfuttrup)\
**Post date:** [April 26, 2025, 5:23pm UTC](https://scilab.discourse.group/t/positioning-of-legend-version-2025-0-0/914/2 "2025-04-26T17:23:59Z")

</div>

Hi Jens

Noone came to your assitance. Could you maybe post more complete but still minimal code, something that executes without errors?

The provided code fails with a bunch of ‘Undefined variable:’ errors.

With kind regards,  
Claus

---

<div class="post-metadata">

**Author:** ![Jens](https://avatars.discourse-cdn.com/v4/letter/j/d2c977/32.png) [@Jens](https://scilab.discourse.group/u/Jens)\
**Post date:** [April 27, 2025, 8:10am UTC](https://scilab.discourse.group/t/positioning-of-legend-version-2025-0-0/914/3 "2025-04-27T08:10:28Z")

</div>

It looks like

gca().axes\_bounds = [0.5, 0.5, 0.5, 0.5]; instead of [0.5, 0.5, 0.48, 0.5];

repair the positioning of legend. gca() is a 2x2 subplot.  
Conversion between user coordinates an legend coordinates seem to be superflous.

Kind regards  
Jens
