Guest User

Untitled

a guest
Dec 16th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.63 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}
  132.  
  133. documentclass{standalone}
  134. usepackage{pgfplots}
  135. pgfplotsset{compat=newest}
  136. usepgfplotslibrary{fillbetween}
  137. begin{document}
  138. pgfmathdeclarefunction{gauss}{2}{% normal distribution where #1 = mu and #2 = sigma
  139. pgfmathparse{exp(-((x-#1)^2)/(2*#2^2))}%
  140. }
  141. begin{tikzpicture}[every axis/.style={width=4cm}]
  142. begin{axis}[ %axis 2
  143. name=axis2,
  144. no markers, domain=-10:10, samples=100,
  145. %axis lines*=left,
  146. %xlabel=$x$,
  147. ylabel=$y$,
  148. every axis y label/.style={at=(current axis.above origin),anchor=south},
  149. %every axis x label/.style={at=(current axis.right of origin),anchor=west},
  150. %height=5cm, width=12cm,
  151. xtick={-10,0,10},
  152. %xticklabels={-15, 0, 15},
  153. ytick=empty,
  154. ymin=0,
  155. ymax=1.2,
  156. enlargelimits=false, clip=false, axis on top,
  157. %grid = major
  158. ]
  159. addplot [fill=gray!20, draw=none, domain=-10:-2.5] {gauss(0,3)} closedcycle;
  160. addplot [fill=gray!20, draw=none, domain=2.5:10] {gauss(0,3)} closedcycle;
  161. path[name path=axa] (axis cs:-2.5,0.7) -- (axis cs:2.5,0.7);
  162. path[name path=axb] (axis cs:-2.5,0) -- (axis cs:2.5,0);
  163. addplot [
  164. thick,
  165. color=gray,
  166. fill=gray!20,
  167. %fill opacity=0.05
  168. ]
  169. fill between[
  170. of=axa and axb,
  171. %soft clip={domain=0:1},
  172. ];
  173. %
  174. path[name path=axc] (axis cs:5,0.2) -- (axis cs:10,0.2);
  175. path[name path=axd] (axis cs:5,0) -- (axis cs:10,0);
  176. addplot [
  177. thick,
  178. color=black,
  179. fill=black!40,
  180. %fill opacity=0.05
  181. ]
  182. fill between[
  183. of=axc and axd,
  184. %soft clip={domain=0:1},
  185. ];
  186. addplot [gray, dash dot] {gauss(-10,3)};
  187. addplot [black, dashed] {gauss(-5,3)};
  188. addplot [gray] {gauss(0,3)};
  189. addplot [black!80] {gauss(5,3)};
  190. addplot [black, dotted] {gauss(10,3)};
  191. node (bar2a) at (10,1) {};
  192. node (bar2b) at (10,0.2) {};
  193. end{axis}
  194. end{tikzpicture}
  195. end{document}
  196.  
  197. %&lualatex
  198. % !TeX TXS-program:compile = txs:///lualatex/[--shell-escape]
  199. documentclass{standalone}
  200. usepackage{pgfplots}
  201. pgfplotsset{compat=newest}
  202. usepgfplotslibrary{fillbetween}
  203. begin{document}
  204. pgfmathdeclarefunction{gauss}{2}{% normal distribution where #1 = mu and #2 = sigma
  205. pgfmathparse{exp(-((x-#1)^2)/(2*#2^2))}%
  206. }
  207. begin{tikzpicture}[every axis/.style={width=4cm}]
  208. begin{axis}[
  209. name=axis1 %axis 1
  210. no markers, domain=-10:10, samples=100,
  211. %axis lines*=left,
  212. %xlabel=$x$,
  213. ylabel=$y$,
  214. every axis y label/.style={at=(current axis.above origin),anchor=south},
  215. %every axis x label/.style={at=(current axis.right of origin),anchor=west},
  216. %height=5cm, width=12cm,
  217. xtick={-10,0,10},
  218. %xticklabels={-15, 0, 15},
  219. %ytick={0 1},
  220. ymin=0,
  221. ymax=1.2,
  222. enlargelimits=false, clip=false, axis on top,
  223. %grid = major
  224. ]
  225. addplot [gray, dash dot] {gauss(-10,3)};
  226. addplot [black, dashed] {gauss(-5,3)};
  227. addplot [gray] {gauss(0,3)};
  228. addplot [black!80] {gauss(5,3)};
  229. addplot [black, dotted] {gauss(10,3)};
  230. addplot [color=black] coordinates { (2,0) (2,1.2) };
  231. node (bar1a) at (1,1){};
  232. node (bar1b) at (1,0.2){};
  233. end{axis}
  234. begin{axis}[ %axis 2
  235. xshift = 1.15in,
  236. name=axis2,
  237. no markers, domain=-10:10, samples=100,
  238. %axis lines*=left,
  239. %xlabel=$x$,
  240. ylabel=$y$,
  241. every axis y label/.style={at=(current axis.above origin),anchor=south},
  242. %every axis x label/.style={at=(current axis.right of origin),anchor=west},
  243. %height=5cm, width=12cm,
  244. xtick={-10,0,10},
  245. %xticklabels={-15, 0, 15},
  246. ytick=empty,
  247. ymin=0,
  248. ymax=1.2,
  249. enlargelimits=false, clip=false, axis on top,
  250. %grid = major
  251. ]
  252. addplot [fill=gray!20, draw=none, domain=-10:-2.5] {gauss(0,3)} closedcycle;
  253. addplot [fill=gray!20, draw=none, domain=2.5:10] {gauss(0,3)} closedcycle;
  254. path[name path=axa] (axis cs:-2.5,0.7) -- (axis cs:2.5,0.7);
  255. path[name path=axb] (axis cs:-2.5,0) -- (axis cs:2.5,0);
  256. addplot [
  257. thick,
  258. color=gray,
  259. fill=gray!20,
  260. %fill opacity=0.05
  261. ]
  262. fill between[
  263. of=axa and axb,
  264. %soft clip={domain=0:1},
  265. ];
  266. %
  267. path[name path=axc] (axis cs:5,0.2) -- (axis cs:10,0.2);
  268. path[name path=axd] (axis cs:5,0) -- (axis cs:10,0);
  269. addplot [
  270. thick,
  271. color=black,
  272. fill=black!40,
  273. %fill opacity=0.05
  274. ]
  275. fill between[
  276. of=axc and axd,
  277. %soft clip={domain=0:1},
  278. ];
  279. addplot [gray, dash dot] {gauss(-10,3)};
  280. addplot [black, dashed] {gauss(-5,3)};
  281. addplot [gray] {gauss(0,3)};
  282. addplot [black!80] {gauss(5,3)};
  283. addplot [black, dotted] {gauss(10,3)};
  284. node (bar2a) at (10,1) {};
  285. node (bar2b) at (10,0.2) {};
  286. end{axis}
  287. begin{axis}[ %axis 3
  288. yshift = -1in,
  289. name=axis3,
  290. no markers, domain=-15:15, samples=100,
  291. %axis lines*=left,
  292. xlabel=$x$, ylabel=$y$,
  293. every axis y label/.style={at=(current axis.above origin),anchor=south},
  294. %every axis x label/.style={at=(current axis.right of origin),anchor=west},
  295. %height=5cm, width=12cm,
  296. xtick={-15, 0, 15},
  297. %ytick={0 1},
  298. enlargelimits=false, clip=false, axis on top,
  299. %grid = major,
  300. ymin=0,
  301. ymax=1.2,
  302. ]
  303. addplot [gray, dash dot] {gauss(-15,3)};
  304. addplot [black, dashed] {gauss(-7.5,3)};
  305. addplot [gray] {gauss(0,3)};
  306. addplot [black!80] {gauss(7.5,3)};
  307. addplot [black, dotted] {gauss(15,3)};
  308. %addplot [cyan!50!black] {gauss(6.5,1)};
  309. %draw [yshift=-0.6cm, latex-latex](axis cs:4,0) -- node [fill=white] {$1.96sigma$} (axis cs:5.96,0);
  310. addplot [color=black] coordinates { (-4,0) (-4,1.2) };
  311. node (bar3a) at (-4,1) {};
  312. node (bar3b) at (-4,0.2) {};
  313. end{axis}
  314. begin{axis}[ %axis 4
  315. xshift = 1.15in,
  316. yshift = -1in,
  317. name=axis4,
  318. no markers, domain=-15:15, samples=100,
  319. %axis lines*=left,
  320. %xlabel=$x$,
  321. ylabel=$y$,
  322. every axis y label/.style={at=(current axis.above origin),anchor=south},
  323. %every axis x label/.style={at=(current axis.right of origin),anchor=west},
  324. %height=5cm, width=12cm,
  325. xtick={-15, 0, 15},
  326. ytick=empty,
  327. ymin=0,
  328. ymax=1.2,
  329. enlargelimits=false, clip=false, axis on top,
  330. %grid = major
  331. ]
  332. addplot [fill=black!30, draw=none, domain=-15:-10] {gauss(-7.5,3)} closedcycle;
  333. addplot [fill=black!30, draw=none, domain=-5:15] {gauss(-7.5,3)} closedcycle;
  334. addplot [fill=gray!20, draw=none, domain=5.3:15] {gauss(0,3)} closedcycle;
  335. path[name path=axe] (axis cs:-10,0.7) -- (axis cs:-5,0.7);
  336. path[name path=axf] (axis cs:-10,0) -- (axis cs:-5,0);
  337. addplot [
  338. thick,
  339. color=black,
  340. fill=black!30,
  341. %fill opacity=0.05
  342. ]
  343. fill between[
  344. of=axe and axf,
  345. %soft clip={domain=0:1},
  346. ];
  347. %
  348. path[name path=axg] (axis cs:-5,0.2) -- (axis cs:5.3,0.2);
  349. path[name path=axh] (axis cs:-5,0) -- (axis cs:5.3,0);
  350. addplot [
  351. thick,
  352. color=gray,
  353. fill=gray!20,
  354. %fill opacity=0.05
  355. ]
  356. fill between[
  357. of=axg and axh,
  358. %soft clip={domain=0:1},
  359. ];
  360. addplot [gray, dash dot] {gauss(-15,3)};
  361. addplot [black, dashed] {gauss(-7.5,3)};
  362. addplot [gray] {gauss(0,3)};
  363. addplot [black!80] {gauss(7.5,3)};
  364. addplot [black, dotted] {gauss(15,3)};
  365. node (bar4a) at (15,1) {};
  366. node (bar4b) at (15,0.2) {};
  367. node (bar4c) at (0,-0.2) {};
  368. end{axis}
  369. begin{axis}[
  370. name=axis6, %axis 6
  371. xshift = 1.15in,
  372. yshift = -2.5in,
  373. no markers, domain=-0.7:0.7, samples=100,
  374. %axis lines*=left,
  375. %xlabel=$x$,
  376. ylabel=$y$,
  377. every axis y label/.style={at=(current axis.above origin),anchor=south},
  378. %every axis x label/.style={at=(current axis.right of origin),anchor=west},
  379. %height=5cm, width=12cm,
  380. xtick={-0.7,0,0.7},
  381. %xticklabels={-15, 0, 15},
  382. %ytick={0 1},
  383. ymin=0,
  384. ymax=1.2,
  385. enlargelimits=false, clip=false, axis on top,
  386. %grid = major
  387. ]
  388. addplot [fill=gray!80, draw=none, domain=-0.7:-0.125] {gauss(0,.2)} closedcycle;
  389. addplot [fill=gray!80, draw=none, domain=0.125:0.7] {gauss(0,.2)} closedcycle;
  390. path[name path=axi] (axis cs:-0.15,0.75) -- (axis cs:0.15,0.75);
  391. path[name path=axj] (axis cs:-0.15,0) -- (axis cs:0.15,0);
  392. %from this part things go bananas :/ due to shifts :(
  393. % addplot [
  394. % thick,
  395. % color=gray,
  396. % fill=gray!80,
  397. % %fill opacity=0.05
  398. % ]
  399. % fill between[
  400. % of=axi and axj,
  401. % %soft clip={domain=0:1},
  402. % ];
  403. %
  404. % path[name path=axk] (axis cs:-0.7,0.2) -- (axis cs:-0.35,0.2);
  405. % path[name path=axl] (axis cs:-0.7,0) -- (axis cs:-0.35,0);
  406. % addplot [
  407. % thick,
  408. % color=gray,
  409. % fill=gray!20,
  410. % %fill opacity=0.05
  411. % ]
  412. % fill between[
  413. % of=axk and axl,
  414. % %soft clip={domain=0:1},
  415. % ];
  416. addplot [gray, dash dot] {gauss(-0.7,.2)};
  417. addplot [black, dashed] {gauss(-0.35,.2)};
  418. addplot [gray] {gauss(0,.2)};
  419. addplot [black!80] {gauss(0.35,.2)};
  420. addplot [black, dotted] {gauss(0.7,.2)};
  421. node (bar6a) at (0,1.4){};
  422. end{axis}
  423. draw [color=black,dash dot] (bar1a) -- (bar2a);
  424. draw [color=black,dash dot] (bar1b) -- (bar2b);
  425. draw [color=black,dash dot] (bar3a) -- (bar4a);
  426. draw [color=black,dash dot] (bar3b) -- (bar4b);
  427. path [->, draw, color=black] (bar4c) -- node [midway,left] {something}(bar6a);
  428. % draw [color=black,dash dot] (bar2) -- (bar3);
  429. % draw [color=black,dash dot] (bar3) -- (bar4);
  430. % draw [->,thick,color=red,dashed] (bar3) -- (bar4);
  431. % begin{scope}[every node/.style={text width=7cm,align=left}]
  432. % node [below] at (axis1.south) {captionof{figure}{First caption}};
  433. % node [below] at (axis2.south) {captionof{figure}{Second caption}};
  434. % node [below] at (axis3.south) {captionof{figure}{Third caption}};
  435. % end{scope}
  436. end{tikzpicture}
  437. end{document}
  438.  
  439. % used PGFPlots v1.16
  440. documentclass[border=5pt]{standalone}
  441. usepackage{pgfplots}
  442. usepgfplotslibrary{fillbetween}
  443. pgfplotsset{
  444. % use this `compat' level or higher to make use of Lua when compiling
  445. % with lualatex. This `compat' level also makes `axis cs:' the default
  446. % coordinate system for TikZ coordinates
  447. compat=1.12,
  448. % declare some constants and the Gauss function for later use
  449. /pgf/declare function={
  450. ymin = 0;
  451. ymax = 1.2;
  452. %
  453. FillHeight = 0.7;
  454. %
  455. LowerLine = 0.2;
  456. UpperLine = 1.0;
  457. %
  458. xVertBarAxis1 = 2;
  459. xVertBarAxis3 = -4;
  460. %
  461. gauss(mu,sigma) = exp(-((x-mu)^2)/(2*sigma^2));
  462. },
  463. % define a custom style for the `axis' so we don't have to repeat all
  464. % the options over and over again. Of course this also makes it much
  465. % easier to change the style of these plots
  466. my axis style/.style={
  467. ylabel=$y$,
  468. ymin=ymin,
  469. ymax=ymax,
  470. samples=101,
  471. enlargelimits=false,
  472. axis on top,
  473. % use the custom created cycle list here
  474. cycle list name=my cycle list,
  475. every axis y label/.style={
  476. at=(current axis.above origin),
  477. anchor=south,
  478. },
  479. % simply add the `xaxis' path to every plot which uses this style
  480. % (so again it is not needed to repeat this)
  481. execute at begin axis={
  482. path [name path=xaxis]
  483. (pgfkeysvalueof{/pgfplots/xmin},0) --
  484. (pgfkeysvalueof{/pgfplots/xmax},0)
  485. ;
  486. },
  487. % use `extra x ticks' to add the vertical lines to the plots ...
  488. % (the `#1' means that an optional argument to this style will
  489. % be forwarded here)
  490. extra x ticks={#1},
  491. % ... and this is the style which should be applied to the extra ticks
  492. extra x tick style={
  493. xticklabels={},
  494. major tick length=0pt,
  495. grid=major,
  496. grid style={
  497. draw=black,
  498. },
  499. },
  500. },
  501. % define some more custom styles for later use
  502. my light gray fill/.style={
  503. draw=none,
  504. fill=gray!20,
  505. },
  506. my dark gray fill/.style={
  507. draw=none,
  508. fill=black!40,
  509. },
  510. }
  511. % create a custom `cycle list' so that one don't has to repeat this
  512. % over and over again
  513. pgfplotscreateplotcyclelist{my cycle list}{
  514. gray,dash dot\
  515. black,dashed\
  516. gray\
  517. black!80\
  518. black,dotted\
  519. }
  520. begin{document}
  521. begin{tikzpicture}
  522. begin{axis}[
  523. % name this plot so the others can be placed relative to this one
  524. name=axis1,
  525. % use the (optional) argument of the custom style
  526. % to place the vertical line at the given position
  527. my axis style={2},
  528. xtick={-10,0,10},
  529. domain=-10:10,
  530. ]
  531. % with the custom `cycle list' this can be simplified to
  532. foreach i in {-10,-5,...,10} {
  533. addplot {gauss(i,3)};
  534. }
  535.  
  536. % then here it only remains to place the dummy coordinates for the
  537. % horizontal lines, which will be drawn after all `axis' environments
  538. begin{scope}[
  539. xshift=-2.5mm,
  540. ]
  541. coordinate (bar1a) at (xVertBarAxis1,LowerLine);
  542. coordinate (bar1b) at (xVertBarAxis1,UpperLine);
  543. end{scope}
  544. end{axis}
  545.  
  546. begin{axis}[
  547. name=axis2,
  548. % ---------------------------------------------------------------------
  549. my axis style,
  550. % place the other `axis' environments relative to the previous ones
  551. at={(axis1.right of east)},
  552. anchor=left of west,
  553. % ---------------------------------------------------------------------
  554. xtick={-10,0,10},
  555. ytick=empty,
  556. domain=-10:10,
  557. ]
  558. foreach i in {-10,-5,...,10} {
  559. addplot {gauss(i,3)};
  560. }
  561.  
  562. % this is one way of adding the fill
  563. % later it will be shown another one
  564. % ----------------------------------
  565. % put this fill on the same layer as the `fill between' stuff
  566. pgfonlayer{pre main}
  567. % use the custom style here
  568. addplot [my dark gray fill] coordinates {
  569. (0,LowerLine)
  570. (10,LowerLine)
  571. }
  572. closedcycle
  573. ;
  574. endpgfonlayer
  575.  
  576. % here I create a dummy path which is than used by `fill between'
  577. % (optimally this is not needed, but `soft clip={domain y=0:FillHeight}'
  578. % did some strange things)
  579. addplot [
  580. draw=none,
  581. name path=gauss,
  582. ] {min(FillHeight, gauss(0,3))};
  583. addplot [my light gray fill] fill between [
  584. of=gauss and xaxis,
  585. ];
  586.  
  587. % this time we need to place coordinates for the horizontal lines
  588. % at the maximum x values, which are not set explicitly. But we can
  589. % get them with the help of `pgfkeysvalueof{...}'.
  590. coordinate (bar2a) at (pgfkeysvalueof{/pgfplots/xmax},LowerLine);
  591. coordinate (bar2b) at (pgfkeysvalueof{/pgfplots/xmax},UpperLine);
  592. end{axis}
  593.  
  594. begin{axis}[
  595. name=axis3,
  596. % ---------------------------------------------------------------------
  597. my axis style={-4},
  598. at={(axis1.below south)},
  599. anchor=above north,
  600. % ---------------------------------------------------------------------
  601. xlabel=$x$,
  602. xtick={-15,0,15},
  603. domain=-15:15,
  604. ]
  605. foreach i in {-15,-7.5,...,15} {
  606. addplot {gauss(i,3)};
  607. }
  608.  
  609. begin{scope}[
  610. xshift=-5mm,
  611. ]
  612. coordinate (bar3a) at (xVertBarAxis3,LowerLine);
  613. coordinate (bar3b) at (xVertBarAxis3,UpperLine);
  614. end{scope}
  615. end{axis}
  616.  
  617. begin{axis}[
  618. name=axis4,
  619. % ---------------------------------------------------------------------
  620. my axis style,
  621. at={(axis3.right of east)},
  622. anchor=left of west,
  623. % ---------------------------------------------------------------------
  624. xtick={-15,0,15},
  625. ytick=empty,
  626. domain=-15:15,
  627. ]
  628.  
  629. foreach i in {-15,-7.5,...,15} {
  630. addplot {gauss(i,3)};
  631. }
  632.  
  633. addplot [
  634. draw=none,
  635. name path=gauss1,
  636. samples=201,
  637. ] {min(LowerLine, gauss(0,3))};
  638. addplot [my light gray fill] fill between [
  639. of=gauss1 and xaxis,
  640. ];
  641.  
  642. addplot [
  643. draw=none,
  644. name path=gauss2,
  645. samples=201,
  646. ] {min(FillHeight, gauss(-7.5,3))};
  647.  
  648. addplot [my dark gray fill] fill between [
  649. of=gauss2 and xaxis,
  650. ];
  651.  
  652. coordinate (bar4a) at (pgfkeysvalueof{/pgfplots/xmax},LowerLine);
  653. coordinate (bar4b) at (pgfkeysvalueof{/pgfplots/xmax},UpperLine);
  654. end{axis}
  655.  
  656. begin{axis}[
  657. name=axis6,
  658. % ---------------------------------------------------------------------
  659. my axis style,
  660. at={(axis4.below south)},
  661. % because there needs to be some more space for the arrow between
  662. % the plots, we increase the gab
  663. yshift=-10mm,
  664. anchor=above north,
  665. % ---------------------------------------------------------------------
  666. xtick={-0.7,0,0.7},
  667. domain=-0.7:0.7,
  668. ]
  669.  
  670. foreach i in {-0.7,-0.35,...,0.7} {
  671. addplot {gauss(i,0.2)};
  672. }
  673.  
  674. pgfonlayer{pre main}
  675. addplot [my light gray fill] coordinates {
  676. (-0.7,LowerLine)
  677. (0,LowerLine)
  678. }
  679. closedcycle
  680. ;
  681. endpgfonlayer
  682.  
  683. addplot [
  684. draw=none,
  685. name path=gauss,
  686. samples=201,
  687. ] {min(0.75, gauss(0,0.2))};
  688.  
  689. addplot [my dark gray fill] fill between [
  690. of=gauss and xaxis,
  691. ];
  692. end{axis}
  693.  
  694. % draw the horizontal lines between the upper and middle row of plots
  695. draw [dash dot]
  696. (bar1a) -- (bar2a)
  697. (bar1b) -- (bar2b)
  698. (bar3a) -- (bar4a)
  699. (bar3b) -- (bar4b)
  700. ;
  701.  
  702. % draw the arrow between the lower right two plots
  703. draw [->]
  704. % if you want to, you can shift it a bit, as shown here using the
  705. % optional argument of the coordinate
  706. ([xshift=10mm] axis6.above north)
  707. -- node [left] {something}
  708. ([xshift=10mm] axis4.below south)
  709. ;
  710.  
  711. end{tikzpicture}
  712. end{document}
Add Comment
Please, Sign In to add comment