Graphics, Figures & Tablesgnuplot & tikz

Information and discussion about graphics, figures & tables in LaTeX documents.
ZeeRaX
Posts: 10
Joined: Sun May 29, 2011 11:17 pm

gnuplot & tikz

Post by ZeeRaX »

I got the full path there, because I am using portable version of TexMaker and portable version of TeXLive and gnuplot.

I've tryied

Code: Select all

pdfcslatex -shell-escape -synctex=1 -interaction=nonstopmode %.tex
but when I start to compile file - "couldn't start the command".

Personally I think that problem is in TexMaker or TexLive, it cannot see the gnuplot. However command gnuplot from microsoft console seems to run gnuplot correctly (from any path).
TexMaker; Win 7; TeXLive

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

gnuplot & tikz

Post by localghost »

ZeeRaX wrote:I got the full path there, because I am using portable version of TexMaker and portable version of TeXLive and gnuplot. […]
This might the probable cause. But unfortunately I can't advise any further. On my machine everything is fixed installed.
ZeeRaX
Posts: 10
Joined: Sun May 29, 2011 11:17 pm

gnuplot & tikz

Post by ZeeRaX »

Yes, this might be the problem :-/ But every other function worked fine so far.

I noticed that there is sigma on y-axis and it shouldn't be there :(

I don't want to ask more, but since you have it properly working. Can you compile again with following code?

Code: Select all

\begin{tikzpicture}[scale=1.25]
    \colorlet{col1}{blue!70}
    \colorlet{col2}{blue!60}
    \colorlet{col3}{blue!50}
    \colorlet{col4}{blue!40}
   \draw [help lines] (-4.25,-1.25) grid (4.25,1.5);
   \draw [help lines,step=0.25cm] (-2.99,0) grid (2.99,0.99);

   \draw[->] (0,-1.25) -- (0,1.5) node [above]
    % {$\displaystyle
    %    \frac{1}{\sigma\sqrt{2\pi}}\exp\biggl(\frac{-x^2}{2\sigma^2}\biggr)
    % $};

   \begin{scope}[smooth,draw=gray!20,y=0.3989422804cm]
        \filldraw [fill=col3] plot[id=f1,domain=-3:-2] function {exp(-x*x/2)}
            -- (-2,0) -- (-3,0) -- cycle;
        \filldraw [fill=col2] plot[id=f2,domain=-2:-1] function {exp(-x*x/2)}
            -- (-1,0) -- (-2,0) -- cycle;
        \filldraw [fill=col1] plot[id=f3,domain=-1:0]  function {exp(-x*x/2)}
            -- (0,0)  -- (-1,0) -- cycle;
        \filldraw [fill=col1] plot[id=f4,domain=0:1] function {exp(-x*x/2)}
            -- (1,0)  --  (0,0) -- cycle;
        \filldraw [fill=col2] plot[id=f5,domain=1:2] function {exp(-x*x/2)}
            -- (2,0)  -- (1,0) -- cycle;
        \filldraw [fill=col3] plot[id=f6,domain=2:3] function {exp(-x*x/2)}
            -- (3,0)  -- (2,0) -- cycle;
        \draw[black] plot[id=f7,domain=-4.25:4.25,samples=100]
            function {exp(-x*x/2)};
   \end{scope}
       \draw[->] (-4.25,0) -- (4.25,0) node [right] {$x$};

    \foreach \pos/\label in {-3/$-3\sigma$,-2/$-2\sigma$,-1/$-\sigma$,
            1/$\sigma$,2/$2\sigma$,3/$3\sigma$}
        \draw (\pos,0) -- (\pos,-0.1) (\pos cm,-3ex) node
            [anchor=base,fill=white,inner sep=1pt]  {\label};

    \draw (-0.1,1) -- (.1,1) node [right,fill=white,inner sep=1pt] {};

    \foreach \pos/\percent/\height in {1/34/0.5,2/14/0.25,3/2/0.125,4/0.1/0.1}
    {
      \node[text=col\pos,anchor=base,yshift=2pt,xshift=-0.625cm,
        fill=white,inner sep=1pt] at (\pos,\height) {$\percent\%$};
      \node[text=col\pos,anchor=base,yshift=2pt,xshift=.625cm,
        fill=white,inner sep=1pt]  at (-\pos,\height) {$\percent\%$};
    }
\end{tikzpicture}
Hope \sigma won't be there this time.

I really have to thank you again. I didn't expect much when I registered to this forum, but you are doing fine job here! I appreciate your work very much.
TexMaker; Win 7; TeXLive
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: gnuplot & tikz

Post by localghost »

Here you are.
Attachments
gauss.pdf
The rendered output.
(49.67 KiB) Downloaded 159 times
Post Reply