Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1. documentclass{article}
  2. usepackage{pgfplots}
  3. pgfplotsset{width=14cm,compat=newest}
  4. usepgfplotslibrary{dateplot}
  5.  
  6. begin{filecontents*}{data.csv}
  7. count date
  8. 38 2015-01-28
  9. 5 2015-02-11
  10. 21 2015-02-15
  11. 1 2015-02-16
  12. 21 2015-02-17
  13. 21 2015-02-18
  14. 62 2015-02-19
  15. 16 2015-02-25
  16. 4 2015-02-26
  17. 1 2015-02-30
  18. 1 2015-03-07
  19. 44 2015-04-07
  20. end{filecontents*}
  21.  
  22. begin{document}
  23. begin{tikzpicture}
  24. pgfplotstableread{data.csv}table
  25. begin{axis}[
  26. date coordinates in = x,
  27. date ZERO = 2015-01-28,
  28. ymin = 0,
  29. x tick label style = {font = small, text width = 1.7cm, align = center, rotate = 70, anchor = north east},
  30. xtick = data,
  31. xticklabels from table = table{date}
  32. ]
  33. addplot [only marks, blue] table [x = date, y = count] table;%
  34. addplot [green] table [x = date, y = count] table;%
  35. end{axis}
  36. end{tikzpicture}
  37. end{document}
  38.  
  39. documentclass{article}
  40. usepackage{pgfplots,pgfplotstable}
  41. usepackage{filecontents}
  42. pgfplotsset{width=14cm,compat=1.12}
  43.  
  44. begin{filecontents*}{data.csv}
  45. count date
  46. 38 2015-01-28
  47. 5 2015-02-11
  48. 21 2015-02-15
  49. 1 2015-02-16
  50. 21 2015-02-17
  51. 21 2015-02-18
  52. 62 2015-02-19
  53. 16 2015-02-25
  54. 4 2015-02-26
  55. 1 2015-02-30
  56. 1 2015-03-07
  57. 44 2015-04-07
  58. end{filecontents*}
  59.  
  60. begin{document}
  61. begin{tikzpicture}
  62. pgfplotstableread{data.csv}data
  63. begin{axis}[
  64. ymin = 0,
  65. x tick label style = {font = small, text width = 1.7cm, align = center, rotate = 70, anchor = north east},
  66. xtick=data,
  67. xticklabels from table = data{date}
  68. ]
  69. addplot [green,mark=*, mark options={blue}] table [x expr=coordindex, y = count] data;
  70. end{axis}
  71. end{tikzpicture}
  72. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement