SHARE
TWEET

Untitled

a guest Aug 18th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. TIMESTAMP, TIMEDELAY
  2. 2015-08-02 06:00, 00:03
  3. 2015-08-02 06:30, 00:02
  4. 2015-08-02 07:00, 00:03
  5. 2015-08-02 07:30, 00:03
  6. 2015-08-02 08:00, 00:03
  7. 2015-08-02 08:30, 00:03
  8. 2015-08-02 09:00, 00:04
  9. 2015-08-02 09:30, 00:02
  10. 2015-08-02 10:00, 00:03
  11. 2015-08-02 10:30, 00:03
  12. 2015-08-02 11:00, 00:03
  13. 2015-08-02 11:30, 00:03
  14. 2015-08-02 12:00, 00:04
  15. 2015-08-02 12:30, 00:03
  16. 2015-08-02 13:00, 00:03
  17. 2015-08-02 13:30, 00:03
  18. 2015-08-02 14:00, 00:04
  19. 2015-08-02 14:30, 00:04
  20. 2015-08-02 15:00,
  21. 2015-08-02 15:30, 00:03
  22. 2015-08-02 16:00, 00:07
  23. 2015-08-02 16:30, 00:02
  24. 2015-08-02 17:00, 00:03
  25. 2015-08-02 17:30, 00:03
  26. 2015-08-02 18:00, 00:03
  27.      
  28. documentclass{article}
  29. usepackage{pgfplots}
  30. pgfplotsset{compat=newest}
  31. usepgfplotslibrary{dateplot}
  32.  
  33. deftransformtime#1:#2!{
  34.     pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}
  35.     pgfmathparse{#1*3600-pgfkeysvalueof{/pgfplots/timeplot zero}*3600+#2*60}
  36.     pgfkeys{/pgf/fpu=false}
  37. }
  38.  
  39. pgfplotsset{
  40.     timeplot zero/.initial=0,
  41.     timeplot/.style={
  42.         y coord trafo/.code={expandaftertransformtime##1!},
  43.         y coord inv trafo/.code={%
  44.             pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed,}
  45.             pgfmathsetmacrohours{floor(##1/3600)+pgfkeysvalueof{/pgfplots/timeplot zero}}
  46.             pgfmathsetmacrominutes{floor((##1-(hours - pgfkeysvalueof{/pgfplots/timeplot zero})*3600)/60)}
  47.             pgfmathsetmacroseconds{##1-floor((##1)/60)*60}
  48.             defpgfmathresult{pgfmathprintnumber{hours}:pgfmathprintnumber{minutes}:pgfmathprintnumber[fixed zerofill]{seconds}}
  49.             pgfkeys{/pgf/fpu=false}
  50.         },
  51.     scaled y ticks=false,
  52.     yticklabel=tick
  53.     }
  54. }
  55.  
  56. begin{document}
  57. begin{tikzpicture}
  58. begin{axis}[
  59.     timeplot, timeplot zero=0, grid=major, grid style=dashed, ,
  60. ]
  61. addplot table {
  62. State           Time  
  63. 6 00:03
  64. 6.5 00:02
  65. 7 00:03
  66. 7.5 00:03
  67. 8 00:03
  68. 8.5 00:03
  69. 9 00:04
  70. 9.5 00:02
  71. 10 00:03
  72. 10.5 00:03
  73. 11 00:03
  74. 11.5 00:03
  75. 12 00:04
  76. 12.5 00:03
  77. 13 00:03
  78. 13.5 00:03
  79. 14 00:04
  80. 14.5 00:04
  81. 15 00:03
  82. };
  83. end{axis}
  84. end{tikzpicture}
  85. end{document}
  86.      
  87. documentclass{article}
  88. usepackage{pgfplotstable}
  89. usepackage{pgfplots}
  90. usepgfplotslibrary{dateplot}
  91. pagestyle{empty}
  92.  
  93.  
  94.  
  95. begin{document}
  96.  
  97. begin{tikzpicture}
  98. begin{axis}[date coordinates in=x,]
  99. addplot table[col sep=comma] {datedata2.csv};;
  100. end{axis}
  101. end{tikzpicture}
  102.  
  103. end{document}
  104.      
  105. documentclass[border=10pt]{standalone}
  106. usepackage{pgfplotstable}
  107. usepackage{pgfplots}
  108. usepgfplotslibrary{dateplot}
  109.  
  110. deftransformtime#1:#2!{
  111.     pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}
  112.     pgfmathparse{#1*3600-pgfkeysvalueof{/pgfplots/timeplot zero}*3600+#2*60}
  113.     pgfkeys{/pgf/fpu=false}
  114. }
  115.  
  116. pgfplotsset{
  117.     timeplot zero/.initial=0,
  118.     timeplot/.style={
  119.         y coord trafo/.code={expandaftertransformtime##1!},
  120.         y coord inv trafo/.code={%
  121.             pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed,}
  122.             pgfmathsetmacrohours{floor(##1/3600)+pgfkeysvalueof{/pgfplots/timeplot zero}}
  123.             pgfmathsetmacrominutes{floor((##1-(hours - pgfkeysvalueof{/pgfplots/timeplot zero})*3600)/60)}
  124.             defpgfmathresult{
  125.                 pgfmathprintnumber{hours}:%
  126.                 pgfmathparse{int(mod(minutes,60))/100}%
  127.                     pgfmathprintnumber[skip 0.=true, dec sep={}, fixed]{pgfmathresult}
  128.                 }
  129.             pgfkeys{/pgf/fpu=false}
  130.         },
  131.         scaled y ticks=false,
  132.         yticklabel=tick
  133.     }
  134. }
  135.  
  136. usepackage{filecontents}
  137. begin{filecontents}{datedata2.csv}
  138. TIMESTAMP, TIMEDELAY
  139. 2015-08-02 06:00, 00:03
  140. 2015-08-02 06:30, 00:02
  141. 2015-08-02 07:00, 00:03
  142. 2015-08-02 07:30, 00:03
  143. 2015-08-02 08:00, 00:03
  144. 2015-08-02 08:30, 00:03
  145. 2015-08-02 09:00, 00:04
  146. 2015-08-02 09:30, 00:02
  147. 2015-08-02 10:00, 00:03
  148. 2015-08-02 10:30, 00:03
  149. 2015-08-02 11:00, 00:03
  150. 2015-08-02 11:30, 00:03
  151. 2015-08-02 12:00, 00:04
  152. 2015-08-02 12:30, 00:03
  153. 2015-08-02 13:00, 00:03
  154. 2015-08-02 13:30, 00:03
  155. 2015-08-02 14:00, 00:04
  156. 2015-08-02 14:30, 00:04
  157. %2015-08-02 15:00, nan
  158. 2015-08-02 15:30, 00:03
  159. 2015-08-02 16:00, 00:07
  160. 2015-08-02 16:30, 00:02
  161. 2015-08-02 17:00, 00:03
  162. 2015-08-02 17:30, 00:03
  163. 2015-08-02 18:00, 00:03
  164. end{filecontents}
  165.  
  166. begin{document}
  167.  
  168. begin{tikzpicture}
  169. begin{axis}[
  170.     timeplot, timeplot zero=0, grid=major, grid style=dashed,
  171.     date coordinates in=x,
  172.     x tick label style={align=center, rotate=45, font=scriptsize},
  173.     ]
  174.     addplot table[col sep=comma] {datedata2.csv};
  175. end{axis}
  176. end{tikzpicture}
  177.  
  178. end{document}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top