enter image description here

I try to draw a generic Gaussian over a ray, to indicate a possible generic trend. At the moment I have managed to draw both the ray and the Gaussian, but I can't get it to lay on the ray, as changing the coordinates changes the whole graph. In the image it is as I would like it to look, as it came is in the code.




  no markers, 
  axis lines*=left, 
  every axis y label/.style={at=(current axis.above origin),anchor=south},
  every axis x label/.style={at=(current axis.right of origin),anchor=west},
  axis on top,
  grid = major,

\clip (axis cs:0,0) rectangle (axis cs:6,1);
\addplot [draw=none,fill=lightgray!50!] {gauss(x, 3, 0.8)};

\addplot [very thick,black!50!] {gauss (x, 3, 0.8)};

\node[coordinate, pin={Spatial and cognitive distance}] at (axis cs: 3, 0.5){};

\addplot[black!50!, thick](x,x); 



Any tips? Thanks a lot <3


Welcome to TeX.SE!!!

If you can use a TikZ picture, it would be very easy. You only have to draw you gaussian function and rotate it.

Like the following example:



% grid
\draw[help lines]  (0,0) grid[step=0.5] (6,6);
% axes
\draw[latex-latex] (0,6) node [above] {$y$} |- (6,0) node [right] {$x$};
% gaussian function
\draw[rotate=45,red,fill=red,fill opacity=0.2] plot[domain=0:{6*sqrt(2)},samples=100] (\x,{gauss(\x,{3*sqrt(2)},0.7)});
% line
\draw (0,0) -- (6,6);
% axes labels
\foreach\i in {1,...,5}
  \node at (\i,0) [below] {$\i$};
  \node at (0,\i) [left]  {$\i$};

enter image description here

  • Wow thank you so much I didn't know about the possibility of rotating the function. Thank again! Oct 18 at 18:55
  • +1: Does the curly bracket syntax {6*sqrt(2)} works out of the box? Oct 19 at 8:26
  • 1
    @Dr.ManuelKuehner, thanks!! Do you mean without the curly brackets? Yes, it works, I put the curly brackets without thinking, because they are always needed in TikZ coordinates. Oct 19 at 8:35
  • Ah, I was assuming that the curly brackets are needed when a calculation is required. Oct 19 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.