SHARE
TWEET

Untitled

a guest Mar 20th, 2019 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. documentclass{standalone}
  2. usepackage{tikz,pgfplots}
  3. usepgfplotslibrary{patchplots}
  4. pgfplotsset{%
  5.     colormap={whitered}{color(0cm)=(transparent); color(1.cm)=(red)}%
  6. }
  7. begin{document}
  8. begin{tikzpicture}[baseline,
  9.     declare function={bivar(ma,sa,mb,sb)=
  10.         1/(2*pi*sa*sb) * exp(-((x-ma)^2/sa^2 + (y-mb)^2/sb^2))/2;}]
  11. % Outer coordinate system
  12. begin{axis}[
  13.     unit vector ratio*=1 1 1,
  14.     axis lines = middle,
  15.     view={120}{30},
  16.     domain = -10:10,
  17.     zmin = -5, zmax = 5,
  18.     ]
  19.     coordinate (origin1) at (axis cs:0,-10,0);
  20.     coordinate (origin2) at (axis cs:0,10,0);
  21.     addplot3[no markers,opacity=0]{0}; % <- without this pseudo plot, the outer coordinate system does not work
  22. end{axis}
  23. % Bivariate distribution 1
  24. begin{axis}[
  25.     at={(origin1)}, anchor={center},
  26.     width=3cm, height=3cm,
  27.     scale only axis,
  28.     axis equal image,
  29.     hide axis,
  30.     colormap name=whitered,
  31.     view={0}{90},
  32.     enlargelimits=false,
  33.     domain=-1.5:1.5, y domain=-1.5:1.5,
  34.     ]
  35.     addplot3 [surf, draw=none, samples=19, shader=interp, patch type=bilinear] {bivar(0,.1,0,.6)};
  36. end{axis}
  37. % Bivariate distribution 2
  38. begin{axis}[
  39.     at={(origin2)}, anchor={center},
  40.     width=3cm, height=3cm,
  41.     scale only axis,
  42.     axis equal image,
  43.     hide axis,
  44.     colormap name=whitered,
  45.     view={0}{90},
  46.     enlargelimits=false,
  47.     domain=-1.5:1.5, y domain=-1.5:1.5,
  48.     ]
  49.     addplot3 [surf, draw=none, samples=19, shader=interp, patch type=bilinear] {bivar(0,.2,0,.3)};
  50. end{axis}
  51. end{tikzpicture}
  52. end{document}
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top