octave-maintainers
[Top][All Lists]
Advanced

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

Re: 'paperpositionmode' change to rid gnuplot_set_term: size is zero


From: Ben Abbott
Subject: Re: 'paperpositionmode' change to rid gnuplot_set_term: size is zero
Date: Mon, 05 Jan 2009 07:20:06 -0500


On Jan 3, 2009, at 5:07 PM, Michael Goffioul wrote:

On Sat, Jan 3, 2009 at 9:38 PM, Ben Abbott <address@hidden> wrote:
In a nutshell ... I'd like to be able to set the default values for
properties representing vectors. For example, figure.paperposition where we'd like the default to be [0.25, 2.5, 8, 6]. I don't see how this can be done. In graphics.h.in I can set each element to the same value (all zeros
for example), but I don't see how to set the default to a vector with
differing values.

You can't. To achieve that, you have to use an indirect way. See for
instance what I did to set the default figure position in graphics.h.in.
Another way would be to have a utility function like

 Matrix make_vector(int n, ...)

that you could use in graphics.h.in to initialize properties with
predefined vector. The implementation of such function would use
stdargs.h or varargs.h.

Then there is the problem that the defaults are set after the callbacks are in place, which changes some of the defaults. As you point out this can be easily fixed, but I'd think it more proper to set the defaults prior to
setting up the callbacks.

I'm not sure what's the best in this specific case. If you want to
force a default value for xtick, then it makes sense to also have
xtickmode set to manual, otherwise your default xtick value would
be useless and immediately overwritten by the system as xtickmode
would be auto. Could anybody check what happens under Matlab:

close all
set(0, 'defaultaxesxtick', [0:1:10])
get(gca, 'xtick')
get(gca, 'xtickmode')

Michael.


Michael/others,

I've essentially mimicked prior examples in order to set the defaults for ...

axes.xticks
axes.yticks
axes.zticks
figure.papersize
figure.paperposition
root.screensize

I've also attempted to add the "character" unit to graphics:convert_positon(...)

There is a typo for the radio value "pixels" for the property text.fontunits which is fixed as well.

I'd appreciate some advice/critque regarding the attached changeset.

Beyond these changes, I'd also like to see the axes.xticklabel / yticklabel / zticklabel updated when the xtick / ytick / ztick is set. I have not looked into how the listeners are handled on the c++ side yet, so I can't ask any intelligent questions. However, it appears to me that it would be proper to set the initial axes.xticklabel / yticklabel / zticklabel default values. However, I have been unable to figure that out.

Is it possible to set the ticklabels using a function (in graphics.cc) as is done for numeric values (for example the one below)

 static Matrix
default_axes_tick (void)
{
  Matrix m (1, 6, 0.0);
  m(0) = 0.0;
  m(1) = 0.2;
  m(2) = 0.4;
  m(3) = 0.6;
  m(4) = 0.8;
  m(5) = 1.0;
  return m;
}

Where graphics.h.in would then have

      row_vector_property xtick m , default_axes_tick ()
      row_vector_property ytick m , default_axes_tick ()
      row_vector_property ztick m , default_axes_tick ()

My naive guess would be to replace "Matrix" with "octave_value" (which I'd bet is wrong, because I can't find any such examples in the code). Beyond that I have no clue how to specify a cell array of strings.

More advice would be appreciated.

Ben


Attachment: changeset-properties.patch
Description: Binary data









reply via email to

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