pgfplots: How to force datetime to only display xticks with even times (18:00) instead of odd times (18:34)?XY plot from date/time data table using pgfplotsplotting two time series with boundsGrouped bar chartHow do i get the x axis on top but keep a line on the bottomPositioning Even or Odd x axis tick labels in PGFPlotsHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?How to hide empty (value 0) ybars with pgfplots?Show mark labels near marks and not centered in ybar interaval graphpgfplots: percentage in matrix plotCenter the axes in the coordinate originFixing default random dates for xticks in dateplot

PTIJ: Why is Haman obsessed with Bose?

Shouldn’t conservatives embrace universal basic income?

Confused about Cramer-Rao lower bound and CLT

Why Shazam when there is already Superman?

Will number of steps recorded on FitBit/any fitness tracker add up distance in PokemonGo?

Is there a nicer/politer/more positive alternative for "negates"?

Taxes on Dividends in a Roth IRA

Giving feedback to someone without sounding prejudiced

What kind of floor tile is this?

What is the English pronunciation of "pain au chocolat"?

What features enable the Su-25 Frogfoot to operate with such a wide variety of fuels?

"before" and "want" for the same systemd service?

How do I tell my boss that I'm quitting soon, especially given that a colleague just left this week

Is it ethical to recieve stipend after publishing enough papers?

Why do ¬, ∀ and ∃ have the same precedence?

Microchip documentation does not label CAN buss pins on micro controller pinout diagram

Biological Blimps: Propulsion

awk assign to multiple variables at once

15% tax on $7.5k earnings. Is that right?

The IT department bottlenecks progress, how should I handle this?

Multiplicative persistence

How much theory knowledge is actually used while playing?

Why can't the Brexit deadlock in the UK parliament be solved with a plurality vote?

Doesn't the system of the Supreme Court oppose justice?



pgfplots: How to force datetime to only display xticks with even times (18:00) instead of odd times (18:34)?


XY plot from date/time data table using pgfplotsplotting two time series with boundsGrouped bar chartHow do i get the x axis on top but keep a line on the bottomPositioning Even or Odd x axis tick labels in PGFPlotsHow to prevent rounded and duplicated tick labels in pgfplots with fixed precision?How to hide empty (value 0) ybars with pgfplots?Show mark labels near marks and not centered in ybar interaval graphpgfplots: percentage in matrix plotCenter the axes in the coordinate originFixing default random dates for xticks in dateplot













1















Assumed we have the following plot from user darthbith to display a pgfplot with a time axis:




Minimum Working Example (MWE):



documentclassstandalone
usepackagepgfplots
usepgfplotslibrarydateplot, statistics
pgfplotssetcompat=newest

usepackagefilecontents

beginfilecontents*data.txt
no, date, value
1, 2015-09-13 21:00:00, 922
2, 2015-09-13 22:00:00, 3993
3, 2015-09-13 23:00:00, 3003
4, 2015-09-14 00:00:00, 991
5, 2015-09-14 01:00:00, 2021
6, 2015-09-14 02:00:00, 841
7, 2015-09-14 03:00:00, 2812
8, 2015-09-14 14:00:00, 991
9, 2015-09-14 15:00:00, 231
10, 2015-09-14 16:00:00, 678
endfilecontents*

begindocument

begintikzpicture

beginaxis[ xlabel=Time,
ylabel=Value,
date coordinates in=x,
table/col sep=comma,
date ZERO=2015-09-13,
xticklabel=hour:minute,
xticklabel style=rotate=90, anchor=near xticklabel, ]

addplot+[no markers] table[x=date,y=value] data.txt;
endaxis

endtikzpicture

enddocument



Screenshot of the result:



Screenshot of the result




Description of the issue:



As you can see, the x-axis has displayed very odd xticks.



How can I force pgfplots to only display even xticks, e.g. nice times like 19:00, 20:00 etc. instead of those unhappy odd random times like 19:12?




I know that I could simply use an approach to only show desired xticks via




  • xticks = 20:00, 21:00
    and


  • xtick label = 20:00, 21:00,

however - this is causing a lot of work in case you have longer time spans containing many values. I guess it is possible to force pgfplots to display only even time numbers by itself anyhow?









share


























    1















    Assumed we have the following plot from user darthbith to display a pgfplot with a time axis:




    Minimum Working Example (MWE):



    documentclassstandalone
    usepackagepgfplots
    usepgfplotslibrarydateplot, statistics
    pgfplotssetcompat=newest

    usepackagefilecontents

    beginfilecontents*data.txt
    no, date, value
    1, 2015-09-13 21:00:00, 922
    2, 2015-09-13 22:00:00, 3993
    3, 2015-09-13 23:00:00, 3003
    4, 2015-09-14 00:00:00, 991
    5, 2015-09-14 01:00:00, 2021
    6, 2015-09-14 02:00:00, 841
    7, 2015-09-14 03:00:00, 2812
    8, 2015-09-14 14:00:00, 991
    9, 2015-09-14 15:00:00, 231
    10, 2015-09-14 16:00:00, 678
    endfilecontents*

    begindocument

    begintikzpicture

    beginaxis[ xlabel=Time,
    ylabel=Value,
    date coordinates in=x,
    table/col sep=comma,
    date ZERO=2015-09-13,
    xticklabel=hour:minute,
    xticklabel style=rotate=90, anchor=near xticklabel, ]

    addplot+[no markers] table[x=date,y=value] data.txt;
    endaxis

    endtikzpicture

    enddocument



    Screenshot of the result:



    Screenshot of the result




    Description of the issue:



    As you can see, the x-axis has displayed very odd xticks.



    How can I force pgfplots to only display even xticks, e.g. nice times like 19:00, 20:00 etc. instead of those unhappy odd random times like 19:12?




    I know that I could simply use an approach to only show desired xticks via




    • xticks = 20:00, 21:00
      and


    • xtick label = 20:00, 21:00,

    however - this is causing a lot of work in case you have longer time spans containing many values. I guess it is possible to force pgfplots to display only even time numbers by itself anyhow?









    share
























      1












      1








      1








      Assumed we have the following plot from user darthbith to display a pgfplot with a time axis:




      Minimum Working Example (MWE):



      documentclassstandalone
      usepackagepgfplots
      usepgfplotslibrarydateplot, statistics
      pgfplotssetcompat=newest

      usepackagefilecontents

      beginfilecontents*data.txt
      no, date, value
      1, 2015-09-13 21:00:00, 922
      2, 2015-09-13 22:00:00, 3993
      3, 2015-09-13 23:00:00, 3003
      4, 2015-09-14 00:00:00, 991
      5, 2015-09-14 01:00:00, 2021
      6, 2015-09-14 02:00:00, 841
      7, 2015-09-14 03:00:00, 2812
      8, 2015-09-14 14:00:00, 991
      9, 2015-09-14 15:00:00, 231
      10, 2015-09-14 16:00:00, 678
      endfilecontents*

      begindocument

      begintikzpicture

      beginaxis[ xlabel=Time,
      ylabel=Value,
      date coordinates in=x,
      table/col sep=comma,
      date ZERO=2015-09-13,
      xticklabel=hour:minute,
      xticklabel style=rotate=90, anchor=near xticklabel, ]

      addplot+[no markers] table[x=date,y=value] data.txt;
      endaxis

      endtikzpicture

      enddocument



      Screenshot of the result:



      Screenshot of the result




      Description of the issue:



      As you can see, the x-axis has displayed very odd xticks.



      How can I force pgfplots to only display even xticks, e.g. nice times like 19:00, 20:00 etc. instead of those unhappy odd random times like 19:12?




      I know that I could simply use an approach to only show desired xticks via




      • xticks = 20:00, 21:00
        and


      • xtick label = 20:00, 21:00,

      however - this is causing a lot of work in case you have longer time spans containing many values. I guess it is possible to force pgfplots to display only even time numbers by itself anyhow?









      share














      Assumed we have the following plot from user darthbith to display a pgfplot with a time axis:




      Minimum Working Example (MWE):



      documentclassstandalone
      usepackagepgfplots
      usepgfplotslibrarydateplot, statistics
      pgfplotssetcompat=newest

      usepackagefilecontents

      beginfilecontents*data.txt
      no, date, value
      1, 2015-09-13 21:00:00, 922
      2, 2015-09-13 22:00:00, 3993
      3, 2015-09-13 23:00:00, 3003
      4, 2015-09-14 00:00:00, 991
      5, 2015-09-14 01:00:00, 2021
      6, 2015-09-14 02:00:00, 841
      7, 2015-09-14 03:00:00, 2812
      8, 2015-09-14 14:00:00, 991
      9, 2015-09-14 15:00:00, 231
      10, 2015-09-14 16:00:00, 678
      endfilecontents*

      begindocument

      begintikzpicture

      beginaxis[ xlabel=Time,
      ylabel=Value,
      date coordinates in=x,
      table/col sep=comma,
      date ZERO=2015-09-13,
      xticklabel=hour:minute,
      xticklabel style=rotate=90, anchor=near xticklabel, ]

      addplot+[no markers] table[x=date,y=value] data.txt;
      endaxis

      endtikzpicture

      enddocument



      Screenshot of the result:



      Screenshot of the result




      Description of the issue:



      As you can see, the x-axis has displayed very odd xticks.



      How can I force pgfplots to only display even xticks, e.g. nice times like 19:00, 20:00 etc. instead of those unhappy odd random times like 19:12?




      I know that I could simply use an approach to only show desired xticks via




      • xticks = 20:00, 21:00
        and


      • xtick label = 20:00, 21:00,

      however - this is causing a lot of work in case you have longer time spans containing many values. I guess it is possible to force pgfplots to display only even time numbers by itself anyhow?







      tikz-pgf pgfplots datetime axis ticks





      share












      share










      share



      share










      asked 7 mins ago









      DaveDave

      903619




      903619




















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "85"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f480791%2fpgfplots-how-to-force-datetime-to-only-display-xticks-with-even-times-1800-i%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes















          draft saved

          draft discarded
















































          Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f480791%2fpgfplots-how-to-force-datetime-to-only-display-xticks-with-even-times-1800-i%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Isabella Eugénie Boyer Biographie | Références | Menu de navigationmodifiermodifier le codeComparator to Compute the Relative Value of a U.S. Dollar Amount – 1774 to Present.

          Join wedge with single bond in chemfigHow to make only one part of double bond bold with chemfig?Crossing bonds in chemfigjoining atoms in chemfig. Two adjacent molculesHow do I selectively change bond length in chemfig?Ugly bond joints in chemfigchemfig: reaction above arrowUsing the mhchem and chemfig packages in conjunctionBonding to specific element letter using chemfigResonance hybrids in chemfigScale chemfig molecule in beamer with tikzWhy does this chemfig bond with a hook start in the middle of the atom?

          Are small insurances worth itIs insurance worth it if you can afford to replace the item? If not, when is it?Is accident insurance worth it for my kids who play sportsIs insuring property for more than it is worth allowed?At what point does it become worth it to file an insurance claim?Are wage loss insurance programs worth the cost compared to having an emergency fund?When is an event worth insuring against?Is insurance worth it if you can afford to replace the item? If not, when is it?FHA loan just commenced : Any way to get any of the up-front mortgage insurance back?Which types of insurances do I need to buy?Should I carry less renter's insurance if I can self-insure?Mortgage Adviser Signed Me Up For Multiple Home and Life Insurances (UK)Why many travel insurances don't cover country of nationality?