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 »

Hello everyone,

I'm sorry but I think I've tryied everything and it doesn't work. Now I am running out of time.

I would be very pleased if someone were so kind and generated for me this plot to pdf and posted link for download.
(It is using tikz and gnuplot). Thank you!

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] {$\sigma$};

    \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}
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

Re: gnuplot & tikz

Post by localghost »

Where is the problem that you can't do it on your own? This is no help desk but a discussion forum.


Best regards and welcome to the board
Thorsten
ZeeRaX
Posts: 10
Joined: Sun May 29, 2011 11:17 pm

Re: gnuplot & tikz

Post by ZeeRaX »

Okey, thank you for very fast reply and warm welcoming.

Iam runnig windows 7. So far I understand that you need to have gnuplot as system variable - done. I am using packages
\usepackage[x11names, rgb]{xcolor}
\usepackage{tikz}

But whatever I do, I'll get only grid. But curve is not shown.
By whatever I mean adding commands such as --shell-escape or --enable-write18

Uh, Im sorry and I am runnign TeXlive and TexMaker 3.0.2
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 »

Try to execute Gnuplot from the command line. This way we might be able to exclude at least one source of failure. You might need to restart your machine. Sometimes that helps to make the system aware of changes in the PATH environment variable.
ZeeRaX
Posts: 10
Joined: Sun May 29, 2011 11:17 pm

Re: gnuplot & tikz

Post by ZeeRaX »

I wrote that I have gnuplotn set as system variable :)

When I write in command line "gnuplot" it starts gnuplot console ver. 4.4 patchlevel 3.

Anyway I've spent too much time solving this with not much of success. I need this plot for my thesis till tommorow or day after. It would be great if someone who has working gnuplot correctly generated it for me.

----
Uh, okey.. when I parse tex file in Texmaker it wrote in console
"gnuplot is not name of internal nor external command or executable programme"
TexMaker; Win 7; TeXLive
ZeeRaX
Posts: 10
Joined: Sun May 29, 2011 11:17 pm

Re: gnuplot & tikz

Post by ZeeRaX »

I know it is not polite, but I am really running out of possibilities... and time :cry:
TexMaker; Win 7; TeXLive
ZeeRaX
Posts: 10
Joined: Sun May 29, 2011 11:17 pm

Re: gnuplot & tikz

Post by ZeeRaX »

Sorry guys, I'm kind of desperate here.

Do you know anyone who has working gnuplot with latex? And is willing to run code above and send me output pdf please?

Or can you suggest where should I ask?
TexMaker; Win 7; TeXLive
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

gnuplot & tikz

Post by localghost »

ZeeRaX wrote:I wrote that I have gnuplotn set as system variable […]
That's clear to me. I just wanted to remark that there might be some stumbling blocks. Wind0ws can sometimes be very touchy.
ZeeRaX wrote: […] When I write in command line "gnuplot" it starts gnuplot console ver. 4.4 patchlevel 3. […]
So we seem to have a problem here with the settings of TeXmaker (TXM) to call external programs. I installed TXM 3 on my old Wind0ws system (XP SP3) and got it working with the settings shown in the attached picture. The attached PDF file was compiled using PDFLaTeX with these settings. Note that the used TeX system was MiKTeX, thus the switch --enable-write18 has to be replaced with -shell-escape for TeX Live.
ZeeRaX wrote:[…] Uh, okey.. when I parse tex file in Texmaker it wrote in console
"gnuplot is not name of internal nor external command or executable programme"
Attach the complete log file to your next post by uploading it to the forum server.

I'm not happy with this solution, but I attached the resulting output as a cropped and ready-to-use PDF graphics file (if only unwilling). It would be more satisfactory if we could find a remedy for this problem. Regarding the time pressure it seems to the best at the moment.
Attachments
Configuration window of TeXmaker 3.
Configuration window of TeXmaker 3.
TeXmaker3-Configuration.png (82.22 KiB) Viewed 5648 times
gauss.pdf
The resulting output of the provided code snippet.
(49.71 KiB) Downloaded 162 times
ZeeRaX
Posts: 10
Joined: Sun May 29, 2011 11:17 pm

Re: gnuplot & tikz

Post by ZeeRaX »

Thank you localhost, you are VERY KIND!

Here are my settings and output.
Attachments
Thesis.log
(68.18 KiB) Downloaded 257 times
settings
settings
gnu1.jpg (18.22 KiB) Viewed 5705 times
result
result
gnu0.jpg (60.92 KiB) Viewed 5705 times
TexMaker; Win 7; TeXLive
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

gnuplot & tikz

Post by localghost »

Is it always necessary to insert the path "../bin/win32/…" in your settings? What happens if you call the compiler engines simply like shown in my attachment (the default excerpt for the parameters)?

Code: Select all

pdfcslatex -shell-escape -synctex=1 -interaction=nonstopmode %.tex
Post Reply