Guest User

Untitled

a guest
Dec 13th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.84 KB | None | 0 0
  1. documentclass{standalone}
  2. usepackage{pgfplots}
  3. pgfplotsset{compat=newest}
  4. usepgfplotslibrary{fillbetween}
  5. begin{document}
  6. pgfmathdeclarefunction{gauss}{2}{% normal distribution where #1 = mu and #2 = sigma
  7. pgfmathparse{exp(-((x-#1)^2)/(2*#2^2))}%
  8. }
  9. begin{tikzpicture}[every axis/.style={width=4cm}]
  10. begin{axis}[
  11. name=axis6, %axis 6
  12. xshift = 1.15in,
  13. yshift = -2.5in,
  14. no markers, domain=-0.7:0.7, samples=100,
  15. %axis lines*=left,
  16. %xlabel=$x$,
  17. ylabel=$y$,
  18. every axis y label/.style={at=(current axis.above origin),anchor=south},
  19. %every axis x label/.style={at=(current axis.right of origin),anchor=west},
  20. %height=5cm, width=12cm,
  21. xtick={-0.7,0,0.7},
  22. %xticklabels={-15, 0, 15},
  23. %ytick={0 1},
  24. ymin=0,
  25. ymax=1.2,
  26. enlargelimits=false, clip=false, axis on top,
  27. %grid = major
  28. ]
  29. addplot [fill=gray!80, draw=none, domain=-0.7:-0.125] {gauss(0,.2)} closedcycle;
  30. addplot [fill=gray!80, draw=none, domain=0.125:0.7] {gauss(0,.2)} closedcycle;
  31. path[name path=axi] (axis cs:-0.15,0.75) -- (axis cs:0.15,0.75);
  32. path[name path=axj] (axis cs:-0.15,0) -- (axis cs:0.15,0);
  33. %from this part things go bananas :/
  34. % addplot [
  35. % thick,
  36. % color=gray,
  37. % fill=gray!80,
  38. % %fill opacity=0.05
  39. % ]
  40. % fill between[
  41. % of=axi and axj,
  42. % %soft clip={domain=0:1},
  43. % ];
  44. %
  45. % path[name path=axk] (axis cs:-0.7,0.2) -- (axis cs:-0.35,0.2);
  46. % path[name path=axl] (axis cs:-0.7,0) -- (axis cs:-0.35,0);
  47. % addplot [
  48. % thick,
  49. % color=gray,
  50. % fill=gray!20,
  51. % %fill opacity=0.05
  52. % ]
  53. % fill between[
  54. % of=axk and axl,
  55. % %soft clip={domain=0:1},
  56. % ];
  57. addplot [gray, dash dot] {gauss(-0.7,.2)};
  58. addplot [black, dashed] {gauss(-0.35,.2)};
  59. addplot [gray] {gauss(0,.2)};
  60. addplot [black!80] {gauss(0.35,.2)};
  61. addplot [black, dotted] {gauss(0.7,.2)};
  62. node (bar6a) at (0,1.4){};
  63. end{axis}
  64. end{tikzpicture}
  65. end{document}
  66.  
  67. documentclass{standalone}
  68. usepackage{pgfplots}
  69. pgfplotsset{compat=newest}
  70. usepgfplotslibrary{fillbetween}
  71. begin{document}
  72. pgfmathdeclarefunction{gauss}{2}{% normal distribution where #1 = mu and #2 = sigma
  73. pgfmathparse{exp(-((x-#1)^2)/(2*#2^2))}%
  74. }
  75. begin{tikzpicture}[every axis/.style={width=4cm}]
  76. begin{axis}[
  77. name=axis6, %axis 6
  78. xshift = 1.15in,
  79. yshift = -2.5in,
  80. no markers, domain=-0.7:0.7, samples=100,
  81. %axis lines*=left,
  82. %xlabel=$x$,
  83. ylabel=$y$,
  84. every axis y label/.style={at=(current axis.above origin),anchor=south},
  85. %every axis x label/.style={at=(current axis.right of origin),anchor=west},
  86. %height=5cm, width=12cm,
  87. xtick={-0.7,0,0.7},
  88. %xticklabels={-15, 0, 15},
  89. %ytick={0 1},
  90. ymin=0,
  91. ymax=1.2,
  92. enlargelimits=false, clip=false, axis on top,
  93. %grid = major
  94. ]
  95. addplot [fill=gray!80, draw=none, domain=-0.7:-0.125] {gauss(0,.2)} closedcycle;
  96. addplot [fill=gray!80, draw=none, domain=0.125:0.7] {gauss(0,.2)} closedcycle;
  97. path[name path=axi] (axis cs:-0.15,0.75) -- (axis cs:0.15,0.75);
  98. path[name path=axj] (axis cs:-0.15,0) -- (axis cs:0.15,0);
  99. %from this part things go bananas :/
  100. addplot [
  101. thick,
  102. color=gray,
  103. fill=gray!80,
  104. %fill opacity=0.05
  105. ]
  106. fill between[
  107. of=axi and axj,
  108. %soft clip={domain=0:1},
  109. ];
  110. %
  111. % path[name path=axk] (axis cs:-0.7,0.2) -- (axis cs:-0.35,0.2);
  112. % path[name path=axl] (axis cs:-0.7,0) -- (axis cs:-0.35,0);
  113. % addplot [
  114. % thick,
  115. % color=gray,
  116. % fill=gray!20,
  117. % %fill opacity=0.05
  118. % ]
  119. % fill between[
  120. % of=axk and axl,
  121. % %soft clip={domain=0:1},
  122. % ];
  123. addplot [gray, dash dot] {gauss(-0.7,.2)};
  124. addplot [black, dashed] {gauss(-0.35,.2)};
  125. addplot [gray] {gauss(0,.2)};
  126. addplot [black!80] {gauss(0.35,.2)};
  127. addplot [black, dotted] {gauss(0.7,.2)};
  128. node (bar6a) at (0,1.4){};
  129. end{axis}
  130. end{tikzpicture}
  131. end{document}
Add Comment
Please, Sign In to add comment