octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #52184] 'position' axes property value is inco


From: Etienne Dechamps
Subject: [Octave-bug-tracker] [bug #52184] 'position' axes property value is incorrect when using gnuplot toolkit
Date: Sat, 7 Oct 2017 13:55:20 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0

Follow-up Comment #2, bug #52184 (project octave):

Thanks for your reply. I suspected as much. To give more context (and at the
risk of getting a bit off-topic), here's what I was trying to achieve when I
came across this bug:


% Draws an annotation using coordinates referred to the data axes,
% as opposed to normalized figure coordinates.
function h = data_annotation(name, x, y)
        % Normalize coordinates relative to data limits
        x = (x - xlim()(1)) / diff(xlim());
        y = (y - ylim()(1)) / diff(ylim());

        axes_position = get(gca(), 'position');
        axes_x = axes_position(1);
        axes_y = axes_position(2);
        axes_width = axes_position(3);
        axes_height = axes_position(4);

        % Translate normalized axis coordinates to figure coordinates
        x = x * axes_width + axes_x;
        y = y * axes_height + axes_y;

        h = annotation(name, x, y);
endfunction


I suspect that because of the present bug, the function above is impossible to
implement correctly when using the gnuplot toolkit, unless one manually sets
the axes position in stone before calling the function. Which I don't want to
do, but at this point it doesn't look like I have a choice. Any suggestions?

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52184>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]