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

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

[Octave-bug-tracker] [bug #58530] missing functions: xline() and yline()


From: Rik
Subject: [Octave-bug-tracker] [bug #58530] missing functions: xline() and yline()
Date: Thu, 7 Apr 2022 11:15:59 -0400 (EDT)

Follow-up Comment #9, bug #58530 (project octave):

An initial implementation would be great, and then we can improve things from
there.  This is not a difficult Octave project, but neither is it a trivial
one.

The issue is that Matlab is not creating a static "line" graphics object. 
Instead, they have created a new fundamental graphics type called
"constantline".  In Octave, we can mimic that behavior by creating an hggroup
object and then using addproperties() to create the properties that are
missing from an ordinary line object.  A good example to build from is area.m
in scripts/plot/draw directory.

The other tricky thing is that "constantline" is a dynamic object.  If the
axis is resized then the underlying line object needs to have the data points
changed so it again occupies the entire plot.  This is entirely feasible, but
a little tricky.  When the hggroup is being built you will also need to use
the addlistener() function to watch the current axes' "xlim" property (for a
yline object).  The listener function will be a callback that adjusts the data
in the line object to match the new xlimits.

Sample code for testing


yl = yline (2);  # Create yline at y==2, default xlimits of [0, 1]
xlim ([-5, 5]);


The above code should display a line that is now 10 data units long.

But, if you just want to get started and provide an initial implementation we
can refine it from there.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58530>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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