Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. documentclass[border=3mm]{standalone}
  2.  
  3. usepackage{tikz}
  4. usetikzlibrary{calc}
  5. usepackage{pgfplots, pgfplotstable}
  6. pgfplotsset{compat=1.15}
  7. usepgfplotslibrary{polar}
  8.  
  9. usepackage{filecontents}
  10. begin{filecontents*}{radar_calc_test.csv}
  11. name,class,radius,angpos
  12. a, 1, 9, 1
  13. b, 1, 3, 0.1
  14. c, 2, 6, -1
  15. d, 1, 6, -0.5
  16. e, 2, 8, -0.3
  17. f, 2, 5, 0.2
  18. g, 2, 2, 0.8
  19. h, 1, 8, -0.4
  20. i, 2, 9, 0
  21. j, 2, 7, 0
  22. v, 2, 2, -0.7
  23. w, 1, 4, -0.7
  24. x, 1, 7, 0.5
  25. y, 1, 2, 0.5
  26. z, 1, 1, -0.5
  27. end{filecontents*}
  28. % name, angular segment, radius
  29. % angular_position_in_segment = class*SegmentAngleWidth+SegmentAngleWidth/2*(1+angpos)
  30.  
  31.  
  32. begin{document}
  33.  
  34. defSegmentAngleWidth{90}
  35.  
  36. pgfplotstableset{% global config, for example in the preamble
  37. create on use/angular_position/.style={
  38. create col/expr={
  39. thisrow{class}*SegmentAngleWidth+SegmentAngleWidth/2*(1+thisrow{angpos})
  40. }
  41. }
  42. }
  43.  
  44. begin{tikzpicture}
  45. begin{polaraxis}[
  46. visualization depends on={value thisrow{name} as labelname}
  47. ]
  48. addplot[
  49. scatter/classes={
  50. 1={
  51. mark = text,
  52. text mark as node = true,
  53. text mark = labelname,
  54. text mark style = {
  55. circle,
  56. blue,
  57. draw
  58. }
  59. },
  60. 2={
  61. mark = text,
  62. text mark as node = true,
  63. text mark = labelname,
  64. text mark style = {
  65. red,
  66. draw
  67. }
  68. }
  69. },
  70. scatter,
  71. draw = none,
  72. point meta = explicit symbolic
  73. ] table[
  74. x = angular_position, %"angpos" would work
  75. y = radius,
  76. col sep = comma,
  77. meta = class
  78. ] {radar_calc_test.csv};
  79. end{polaraxis}
  80. end{tikzpicture}
  81. end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement