# see my original graph (a sin-wave over 30 days) plot( 1:30, sin((1:30) .* (2 * pi / 30) ) ) grid on set (gca, 'xtick', 1:7:30 ) # So far puts grid line every 7 days - good! # Now this screws it and the xticks jump back to every 5 days datetick ( 'ddd dd') # So I re-add this - now the whole axis jumps to the right so the days are incorrect (not it only goes up to 20th day) set (gca, 'xtick', 1:7:30 ) I want every day to be monday, or sunday, or whatever _______________________________________________ Help-octave mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-octave |
On Tue, Aug 8, 2017 at 6:03 PM, Tim Pierce <[hidden email]> wrote: I see the same actions that you saw.
_______________________________________________ Help-octave mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-octave |
There seems to be a bug with datetick I've tried on Octave 4.0.0 OS Octave 4.2.1 Win Same, dates jump off to the side I suspect I might be able to work around by keeping integers for gridlines (which behave), and then 'forcibly' setting my own xticklabels On 9 August 2017 at 00:00, Doug Stewart <[hidden email]> wrote:
_______________________________________________ Help-octave mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-octave |
Okay, I can work around the problem with this # I use this to set the major grid lines every 7 days set (gca, 'xtick', min(xm1):7:max(xm1) ) #datetick( "x", "ddd dd mmm") - replace this with get( gca, 'xtick' ); datestr( ans, "ddd dd mmm" ); set (gca, 'xticklabel', ans ); It's not really very ideal though. On 9 August 2017 at 03:48, Tim Pierce <[hidden email]> wrote:
_______________________________________________ Help-octave mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-octave |
The following gives me the same results in Matlab and Octave. Is
this, using 'keeplimits' and/or 'keepticks' what you're looking for? plot( 1:30, sin((1:30) .* (2 * pi / 30) ) ) grid on set (gca, 'xtick', 1:7:30) datetick ('x', 'ddd dd', 'keepticks', 'keeplimits') output images attached _______________________________________________ Help-octave mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-octave datetickplotcompare.png (92K) Download Attachment |
Yes, that must be it The datetick in octave does something quite unpredictable from the example I gave, where the sin wave wouldbe intact, but it wold stretch toonly the 20th day, instead of the 30th Thanks On 9 August 2017 at 15:12, Nicholas Jankowski <[hidden email]> wrote: The following gives me the same results in Matlab and Octave. Is _______________________________________________ Help-octave mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-octave |
On Wed, Aug 9, 2017 at 11:05 AM, Tim Pierce <[hidden email]> wrote:
> Yes, that must be it > > The datetick in octave does something quite unpredictable from the example I > gave, where the sin wave wouldbe intact, but it wold stretch toonly the 20th > day, instead of the 30th Well, whether or not it's odd, matlab is also odd, and there does appear to be some sort of output incompatibility. Running through your initial example without the 'keep' options, I've attached the graphs as they look just before and after the final line: 1 plot( 1:30, sin((1:30) .* (2 * pi / 30) ) ) 2 grid on 3 set (gca, 'xtick', 1:7:30) 4 datetick ('x', 'ddd dd') (note, matlab doesn't let you leave out the 'x', but octave does. doesn't change octave's output) So matlab is also changing both the limits and tick locations of the plot, but it's doing so differently than octave. It appears that neither the inline help or website documentation provide any insight into how datetick selects tick and limit values. nickj _______________________________________________ Help-octave mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-octave datetickplotcompare2.png (165K) Download Attachment |
Your Octave example reverts to 5-day gridlines, which is the issue, it has altered the x-ticks now if you change those x-ticks it will stretch them out to fit 2- days like I said I dont think its worth investigating much further for 'this' discussion as we have 2 solutions, and I like the 'keepticks' and 'keeplimits' but it probably should be rasied as a bug for Octave. One would expect the xticks to be unaffected And Matlab just appears to be on crack in your example... unless Tues 1 is from the next month, which is only thing I can imagine, it is as though it has set the xticks to xlim (x limits of the plot asa matrix [min, max] ) On 9 August 2017 at 16:35, Nicholas Jankowski <[hidden email]> wrote: On Wed, Aug 9, 2017 at 11:05 AM, Tim Pierce <[hidden email]> wrote: _______________________________________________ Help-octave mailing list [hidden email] https://lists.gnu.org/mailman/listinfo/help-octave |
Free forum by Nabble | Edit this page |