axis manipulations in plots are unnecessarily restrictive

pstrang pstrang_w_rzekle at yahoo.com
Fri Jun 6 10:19:12 CDT 2008


http://www.nabble.com/file/p17694734/gregaxd.m gregaxd.m 
http://www.nabble.com/file/p17694734/gregorian.m gregorian.m 

The attached gregaxd.m script adjusts the x-axis labels as expected in
Matlab.  But fails in Octave 3.0.0 with gnuplot 4.2.2.

The script takes julian days and coverts them to gregorian and creates
xticks and labels based on the resolution you enter, for example: 
"gregaxd(column(:,1),7)" converts the current plot x-axis labels in julian
days to gregorian with ticks and labels spaced 7 days apart.

Here are the errors I get:

octave:23> gregaxd(results(:,1),7)
warning: set: invalid property `xticklabels'
warning: set: invalid property `units'
warning: get: invalid property `pos'
error: value on right hand side of assignment is undefined
error: evaluating assignment expression near line 49, column 4
error: called from `gregaxd' in file `/home/xxxx/time_scripts/gregaxd.m'

Since, as mentioned, the goal here is Matlab compatibility, here is an
instance that works in Matlab, but fails in Octave.

Ideas?


John W. Eaton wrote:
> 
> On  6-Mar-2008, Rob Mahurin wrote:
> 
> | On Mar 6, 2008, at 1:22 PM, John W. Eaton wrote:
> | 
> | > On  6-Mar-2008, Rob Mahurin wrote:
> | >
> | > | The change to "graphics handle" plot manipulation has made some
> | > | tweaks to gnuplot's default axes impossible.  I have (somewhat)
> | > | rewritten them in the new language and would be glad to see them
> | > | officially supported in a later version of Octave.
> | >
> | > | 	# eliminate the tics, but keep the box
> | > | 	set(gca,"visible","lines");
> | >
> | > Try
> | >
> | >   set (gca, "xtick", [], "ytick", []);
> | >
> | > instead.
> | 
> | That's half of what I want.  But I more frequently use tics without  
> | lines (see attached example).  Is there a way to do that, apart from  
> | my patch?
> 
> I don't see a way at the moment.  Is there a way to do it with Matlab?
> If so, then we should use that method rather than inventing something
> different.  If not, then to support it we would need to decide what
> property should be used for this purpose.
> 
> | I understand that, and I'd expect that in the long term such an  
> | option would be implemented entirely by Octave --- that is, a call like
> | 
> | 	set(gca,"xticklabels","%.3f","formatpercents","true")
> 
> I think the Matlab way of doing this would be
> 
>   xtick = get (gca, 'xtick');
>   n = numel (xtick);
>   xticklabel = cell (1, n);
>   for i = 1:n
>     xticklabel{i} = sprintf ('%.3f', xtick(i));
>   end
>   set (gca, 'xticklabel', xticklabel);
> 
> You could of course package this in a function to reduce typing, so
> I'm not sure it is necessary to have new special purpose properties.
> Note also that this method is more flexible because you are not forced
> to have all numeric labels.
> 
> Unfortunately this doesn't quite work in Octave yet because we still
> leave the calculation of the tick locations to gnuplot, though that
> will eventually change.
> 
> jwe
> _______________________________________________
> Bug-octave mailing list
> Bug-octave at octave.org
> https://www.cae.wisc.edu/mailman/listinfo/bug-octave
> 
> 
-- 
View this message in context: http://www.nabble.com/axis-manipulations-in-plots-are-unnecessarily-restrictive-tp15880016p17694734.html
Sent from the Octave - Bugs mailing list archive at Nabble.com.



More information about the Bug-octave mailing list