Guest User

Untitled

a guest
Dec 13th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.90 KB | None | 0 0
  1. documentclass[a4paper]{article}
  2. usepackage{pgfplots}
  3. usepackage{comment}
  4. usepackage{filecontents}
  5. usepackage{geometry}
  6. usepackage{tikz}
  7.  
  8. usepgfplotslibrary{dateplot}
  9. defremoveleadingzeros#1{if0#1 expandafterelse#1fi}
  10.  
  11. deftransformtime#1:#2:#3!{
  12. pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}
  13. %pgfmathparse{#1*3600-pgfkeysvalueof{/pgfplots/timeplot zero}*3600+#2*60+#3}
  14. pgfmathparse{removeleadingzeros#1*3600-pgfkeysvalueof{/pgfplots/timeplot zero}*3600+removeleadingzeros#2*60+removeleadingzeros#3}
  15. pgfkeys{/pgf/fpu=false}
  16. }
  17.  
  18.  
  19. pgfplotsset{
  20. timeplot zero/.initial=0,
  21. timeplot/.style={
  22. x coord trafo/.code={expandaftertransformtime##1!},
  23. x coord inv trafo/.code={%
  24. pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}
  25. pgfmathsetmacrohours{floor(##1/3600)+pgfkeysvalueof{/pgfplots/timeplot zero}}
  26. pgfmathsetmacrominutes{floor((##1-(hours-pgfkeysvalueof{/pgfplots/timeplot zero})*3600)/60)}
  27. pgfmathsetmacroseconds{##1-floor(##1/60)*60}
  28. defpgfmathresult{pgfmathparse{mod(hours,60)<10?"0":{},int(mod(hours,60))}pgfmathresult:pgfmathparse{mod(minutes,60)<10?"0":{},int(mod(minutes,60))}pgfmathresult:pgfmathparse{mod(seconds,60)<10?"0":{},int(mod(seconds,60))}pgfmathresult}
  29. pgfkeys{/pgf/fpu=false}
  30. },
  31. scaled x ticks=false,
  32. xticklabel=tick
  33. }
  34. }
  35. begin{document}
  36.  
  37.  
  38. begin{filecontents*}{boom.dat}
  39. tijd diameter
  40. 00:00:00 656.405681
  41. 00:15:00 656.410403
  42. 00:30:00 656.415722
  43. 00:45:00 656.419879
  44. 01:00:00 656.422925
  45. 01:15:00 656.425762
  46. 01:30:00 656.429439
  47. 01:45:00 656.432858
  48. 02:00:00 656.435443
  49. 02:15:00 656.437564
  50. 02:30:00 656.438722
  51. 02:45:00 656.441318
  52. 03:00:00 656.443924
  53. 03:15:00 656.446608
  54. 03:30:00 656.449341
  55. 03:45:00 656.450762
  56. 04:00:00 656.451835
  57. 04:15:00 656.453
  58. 04:30:00 656.454701
  59. 04:45:00 656.456525
  60. 05:00:00 656.458294
  61. 05:15:00 656.460722
  62. 05:30:00 656.462619
  63. 05:45:00 656.464791
  64. 06:00:00 656.466648
  65. 06:15:00 656.467714
  66. 06:30:00 656.469632
  67. 06:45:00 656.470793
  68. 07:00:00 656.471614
  69. 07:15:00 656.47177
  70. 07:30:00 656.472144
  71. 07:45:00 656.472204
  72. 08:00:00 656.472353
  73. 08:15:00 656.471947
  74. 08:30:00 656.471044
  75. 08:45:00 656.467682
  76. 09:00:00 656.45527
  77. 09:15:00 656.438903
  78. 09:30:00 656.422273
  79. 09:45:00 656.41521
  80. 10:00:00 656.408804
  81. 10:15:00 656.402313
  82. 10:30:00 656.393826
  83. 10:45:00 656.385612
  84. 11:00:00 656.378146
  85. 11:15:00 656.372256
  86. 11:30:00 656.367282
  87. 11:45:00 656.361468
  88. 12:00:00 656.355557
  89. 12:15:00 656.350256
  90. 12:30:00 656.343752
  91. 12:45:00 656.337133
  92. 13:00:00 656.332531
  93. 13:15:00 656.32958
  94. 13:30:00 656.328682
  95. 13:45:00 656.327219
  96. 14:00:00 656.321448
  97. 14:15:00 656.315754
  98. 14:30:00 656.312755
  99. 14:45:00 656.311984
  100. 15:00:00 656.31289
  101. 15:15:00 656.313705
  102. 15:30:00 656.316576
  103. 15:45:00 656.323175
  104. 16:00:00 656.327068
  105. 16:15:00 656.326734
  106. 16:30:00 656.329307
  107. 16:45:00 656.34159
  108. 17:00:00 656.344922
  109. 17:15:00 656.344023
  110. 17:30:00 656.34417
  111. 17:45:00 656.344636
  112. 18:00:00 656.345115
  113. 18:15:00 656.344474
  114. 18:30:00 656.344168
  115. 18:45:00 656.34317
  116. 19:00:00 656.343425
  117. 19:15:00 656.343974
  118. 19:30:00 656.345429
  119. 19:45:00 656.351991
  120. 20:00:00 656.361141
  121. 20:15:00 656.366497
  122. 20:30:00 656.374289
  123. 20:45:00 656.381799
  124. 21:00:00 656.389487
  125. 21:15:00 656.395972
  126. 21:30:00 656.402692
  127. 21:45:00 656.408891
  128. 22:00:00 656.416834
  129. 22:15:00 656.422846
  130. 22:30:00 656.428715
  131. 22:45:00 656.435375
  132. 23:00:00 656.441634
  133. 23:15:00 656.445468
  134. 23:30:00 656.449594
  135. 23:45:00 656.452806
  136. end{filecontents*}
  137.  
  138.  
  139.  
  140. begin{filecontents*}{sapstroom.dat}
  141. tijd sapstroom
  142. 00:00:00 4.85408
  143. 00:15:00 4.57286
  144. 00:30:00 4.39551
  145. 00:45:00 4.4178
  146. 01:00:00 4.04949
  147. 01:15:00 3.77214
  148. 01:30:00 3.62084
  149. 01:45:00 3.46315
  150. 02:00:00 3.28671
  151. 02:15:00 3.21523
  152. 02:30:00 3.13485
  153. 02:45:00 2.97071
  154. 03:00:00 2.88493
  155. 03:15:00 2.96935
  156. 03:30:00 2.48116
  157. 03:45:00 2.45723
  158. 04:00:00 2.38146
  159. 04:15:00 2.37392
  160. 04:30:00 2.48235
  161. 04:45:00 2.28593
  162. 05:00:00 2.23122
  163. 05:15:00 2.20008
  164. 05:30:00 2.13761
  165. 05:45:00 2.05941
  166. 06:00:00 1.95399
  167. 06:15:00 1.90721
  168. 06:30:00 1.79834
  169. 06:45:00 1.77564
  170. 07:00:00 1.86757
  171. 07:15:00 2.13706
  172. 07:30:00 2.75334
  173. 07:45:00 3.49142
  174. 08:00:00 4.59272
  175. 08:15:00 6.20182
  176. 08:30:00 8.13804
  177. 08:45:00 10.2965
  178. 09:00:00 12.6352
  179. 09:15:00 14.649
  180. 09:30:00 16.9704
  181. 09:45:00 18.306
  182. 10:00:00 19.6905
  183. 10:15:00 20.6927
  184. 10:30:00 21.2783
  185. 10:45:00 21.9715
  186. 11:00:00 22.2801
  187. 11:15:00 22.4729
  188. 11:30:00 22.697
  189. 11:45:00 22.5211
  190. 12:00:00 22.9484
  191. 12:15:00 22.9198
  192. 12:30:00 22.9355
  193. 12:45:00 23.1047
  194. 13:00:00 23.0004
  195. 13:15:00 23.0681
  196. 13:30:00 22.7262
  197. 13:45:00 22.7039
  198. 14:00:00 23.0067
  199. 14:15:00 23.2884
  200. 14:30:00 23.2097
  201. 14:45:00 22.9358
  202. 15:00:00 22.478
  203. 15:15:00 21.9537
  204. 15:30:00 21.1719
  205. 15:45:00 21.2557
  206. 16:00:00 21.1705
  207. 16:15:00 22.4717
  208. 16:30:00 21.3172
  209. 16:45:00 19.8637
  210. 17:00:00 20.242
  211. 17:15:00 21.574
  212. 17:30:00 21.7862
  213. 17:45:00 21.4883
  214. 18:00:00 21.0291
  215. 18:15:00 20.684
  216. 18:30:00 20.9946
  217. 18:45:00 21.6095
  218. 19:00:00 21.0845
  219. 19:15:00 20.2188
  220. 19:30:00 19.1834
  221. 19:45:00 18.3425
  222. 20:00:00 17.5752
  223. 20:15:00 17.0377
  224. 20:30:00 15.6622
  225. 20:45:00 14.5367
  226. 21:00:00 13.3425
  227. 21:15:00 11.8389
  228. 21:30:00 10.4741
  229. 21:45:00 9.53448
  230. 22:00:00 8.7462
  231. 22:15:00 7.98585
  232. 22:30:00 7.51326
  233. 22:45:00 7.01831
  234. 23:00:00 6.48857
  235. 23:15:00 5.97139
  236. 23:30:00 5.63499
  237. 23:45:00 5.26984
  238. end{filecontents*}
  239.  
  240.  
  241. begin{tikzpicture}
  242. begin{axis}[
  243. %axis lines=center,
  244. xmin=00:00:00, ymax=24:00:00,
  245. ymin=656.3, ymax=656.5,
  246. title=Boomdiagram,
  247. xlabel=Tijdstip,
  248. ylabel=Diameter (mm),
  249. ylabel near ticks,
  250. xlabel near ticks,
  251. timeplot, timeplot zero=0,
  252. xtick={00:00:00,06:00:00,12:00:00,18:00:00,24:00:00},
  253. %minor xtick={00:15:00,00:30:00,00:45:00,01:00:00,01:15:00,01:30:00,01:45:00},
  254. minor ytick={656.1,656.32,...,656.48},
  255. grid=both,
  256. width=linewidth,
  257. %height=8cm,
  258. y tick label style={/pgf/number format/fixed, /pgf/number format/precision=2, /pgf/number format/fixed zerofill},
  259. tick label style={font=small},
  260. x tick label style={rotate=-90},
  261. ]
  262. addplot[blue,mark=*,mark size=1] table [x=tijd, y=diameter] {boom.dat}; label{plot_one}
  263. addlegendentry{Diameter}
  264. end{axis}
  265.  
  266.  
  267.  
  268. begin{axis}[
  269. %axis lines=center,
  270. xmin=00:00:00, ymax=24:00:00,
  271. ymin=0, ymax=25,
  272. title=Boomdiagram,
  273. xlabel=Tijdstip,
  274. axis y line*=right,
  275. ylabel=Sapstroom,
  276. ylabel near ticks,
  277. xlabel near ticks,
  278. timeplot, timeplot zero=0,
  279. xtick={00:00:00,06:00:00,12:00:00,18:00:00,24:00:00},
  280. grid=both,
  281. width=linewidth,
  282. %height=8cm,
  283. x tick label style={rotate=-90},
  284. tick label style={font=small},
  285. ]
  286. addplot[red,mark=triangle*] table [x=tijd, y=sapstroom] {sapstroom.dat};label{plot_two}
  287. addlegendimage{/pgfplots/refstyle=plot_one}addlegendentry{Sapstroom}
  288. addlegendentry{Boomdiameter}
  289.  
  290. end{axis}
  291.  
  292.  
  293. end{tikzpicture}
  294.  
  295.  
  296. end{document}
Add Comment
Please, Sign In to add comment