# Combination Function with Factorial - Not correct result - Pgfplots

\begin{tikzpicture}
\begin{axis}[
axis lines = left,
xlabel = $Number of Elements$,
ylabel = {$Combinations=\frac{(n)!}{(n-r)!(r!)}$},
]
%Axis
domain=2:10,
samples=100,
color=red,
]
%{x!/((x-2)!(2!))};
{ factorial(x)/(factorial(x-2))(factorial(2)))};
\addlegendentry{$\frac{(n)!}{(n-r)!(r!)}$}
\end{axis}
\end{tikzpicture}
• Welcome to TeX.SX! Your code is very welcome, but it would be best if you could convert it to a minimal working example (MWE). Also, experience suggests that code-only questions are not so easy to answer as those with a textual description of the problem too. – Joseph Wright Jul 23 '14 at 6:02
• Welcome to TeX.SX! Please make your code compilable (if possible), or at least complete it with \documentclass{...}, the required \usepackage's, \begin{document}, and \end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – Adam Liter Jul 23 '14 at 6:02
• it might be little complicated, as I copied it from my thesis, most likely requires only : \usepackage{pgfplots} \usepackage{tikz} \begin{document}\end{document}. If yet not comprehensive, I can try to create a MWE. – Sid Jul 23 '14 at 6:08
• @Sid: a minimal working example is not taking stuff from the thesis. It is matter of creating a document that reproduces the problem, the graph in your case. For instance, start with article document class, add pgfplots as a package and include in the document the snippet of code you already provided. That's it. – Claudio Fiandrino Jul 23 '14 at 6:15
• @ClaudioFiandrino:Thanks, I will definitely do it next time. However, PERCUSSE was kind enough to do himself. Can't thank him enough. – Sid Jul 23 '14 at 8:38

Your grouping is not correct and implicit multiplication is not implemented yet.

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.10}
\begin{document}%

\begin{tikzpicture}
\begin{axis}[
axis lines = left,
xlabel = Number of Elements,
ylabel = {$\mathrm{Combinations}=\frac{(n)!}{(n-r)!(r!)}$},
]
%Axis
\addlegendentry{$\frac{(n)!}{(n-r)!(r!)}$}