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: Michael Goffioul
Subject: Re: 'paperpositionmode' change to rid gnuplot_set_term: size is zero
Date: Mon, 5 Jan 2009 12:52:48 +0000

On Mon, Jan 5, 2009 at 12:20 PM, Ben Abbott <address@hidden> wrote:
> 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.

You can use Cell class for that. But in this specific case, I wouldn't
try to add a default_axes_ticklabel() function, but instead provide
a function that can create the cell array of strings from the numerical
values and use it in the init() method and in the tick updater methods.
Schematically (untested), this would look like:

Cell compute_ticklabels(const Matrix& ticks)
{
  ...
}

void init(void)
{
  ...
  xticklabel = compute_ticklabels(xtick.get().matrix_value());
  ...
}

void update_xtick(void)
{
  if (xticklabelmode.is("auto")
    xticklabel = compute_ticklabels(xtick.get().matrix_value());
}

void update_xticklabelmode(void)
{
  if (xticklabelmode.is("auto")
    xticklabel = compute_ticklabels(xtick.get().matrix_value());
}

I hope you get the logic.

Michael.


reply via email to

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