Hi,
Ben Abbott wrote:
Yes, I have seen, that the options are collected into a cell array
within the plot functions. However, keeping the options in a
structure
has the advantage, that I can easily access and set the individual
options, e.g. to transform one plot template into a new one, etc.
Also, how are graphic objects realized internally? Aren't they also
structures? It always seemed quite strange to me, that the get()
function returns a structure, while all the functions setting handle
options take lists of key, value,... as input arguments...
Thorsten
Hmmm ... when I first began using set/get, I had assumed that
s=get(h)
would be reciprocated by set(h,s). Of course there are problems with
that example due to some properties being read-only.
I have been thinking about implementing a way to save a plot by
getting
all the objects in in with get(h) and saving the corresponding
structures - and then being able to reproduce it with a sequence of
set
commands. Will that be possible at all considering those read-only
properties?
However, isn't the functionality below what you're looking for?
style = struct("linewidth", 2, "marker", "x", "markersize", 12);
h = plot (1:10)
set (h, style)
exactly.
I don't see any problem with compatibility. If set() were an m-file,
such a change would take me a few minutes, but with c/c++, I won't be
much help proposing a patch.
I would like to try to do this, if nobody objects to such a change.
Also a question regarding the implementation:
I see that in graphics.cc(DEFUN set) the handle is extracted and the
rest of the arguments are passed to the set method of the graphics
object. If I want to make set accept also structures, I could either
handle this in the DEFUN set (expanding the structure to a list of
key,
value and pass the adapted list of arguments to the set method) or
change the set method itself. Which of the two would be preferable?
Thorsten