2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-19 11:38:05 +02:00

updated code

This commit is contained in:
Martin Thoma 2014-08-20 17:56:58 -04:00
parent 3a8564348e
commit 327111dded
3 changed files with 10 additions and 11 deletions

View file

@ -1,3 +1,7 @@
Compiled example
----------------
![Example](lda-gauss-1.png)
![Example](lda-gauss-1.png)
## Credits
* [How can I make axis lines connected and make axis be over the plot?](http://tex.stackexchange.com/a/196950/5645) answered by [percusse](http://tex.stackexchange.com/users/3235/percusse)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Before After
Before After

View file

@ -11,13 +11,15 @@
\pgfmathdeclarefunction{gauss}{2}{%
\pgfmathparse{1/(sqrt(2*pi*#2))*exp(-((x-#1)^2)/(2*#2))}%
}
% to be used: \gauss(x)(mean)(variance)
% to be used: \gauss(mean)(variance)
\pgfplotsset{
tick label style = {font=\sansmath\sffamily},
every axis label/.append style={font=\sffamily\footnotesize},
}
% Thanks to percusse for solving problems with the axis
\begin{document}
\begin{preview}
\tikzstyle{plotA}=[ultra thick,red!90!black]
@ -28,7 +30,6 @@ every axis label/.append style={font=\sffamily\footnotesize},
height=8.625cm,
% Grid
grid = major,
%grid style={thin, dashed},
% size
xmin= 0, % start the diagram at this x-coordinate
xmax= 125, % end the diagram at this x-coordinate
@ -45,18 +46,13 @@ every axis label/.append style={font=\sffamily\footnotesize},
},
% Ticks
tick align=inside,
%minor tick num=3,
minor tick style={thick},
scaled y ticks = false,
xtick={40,70,80},
ytick=\empty,
% yticklabel={\pgfmathparse{\tick}\pgfmathprintnumber{\pgfmathresult}},
% yticklabel style={
% %/pgf/number format/precision=2,
% /pgf/number format/fixed,
% %/pgf/number format/fixed zerofill
% },
% Axis
axis on top,
axis line style = {very thick,shorten <=-0.5\pgflinewidth},
axis lines = middle,
axis line style = very thick,
xlabel=$x$,
@ -97,7 +93,6 @@ every axis label/.append style={font=\sffamily\footnotesize},
\coordinate (a) at (axis cs:70,0.024);
\draw[black,thick](a |- current plot begin) -- (a);
% Add labels
\node[plotA,above] at (axis cs:102,0.03){\Large $\mathcal{N}(80, 100)$};
\node[plotB,above] at (axis cs:20,0.03){\Large $\mathcal{N}(40, 100)$};