Graphics, Figures & TablesHow can I draw plots in LaTeX?

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

Re: latex,gnuplot

Post by ditka »

Is there a way, that I can check in latex if gnuplot is innstaled?(if latex "knows" for gnuplot)?

Recommended reading 2024:

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

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

ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

Re: latex,gnuplot

Post by ditka »

I now uninstall gnuplot, and I get the same picture. So latex is not connected with gnuplot.

Does anybody have idea why this is happening?
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

Re: latex,gnuplot

Post by ditka »

Since there is apparently no one with similar problems, does somebody have any ideals what else can I change or look, or where to ask to fix this?
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

How can I draw plots in LaTeX?

Post by Stefan Kottwitz »

ditka wrote:Since there is apparently no one with similar problems, does somebody have any ideals what else can I change or look, or where to ask to fix this?
You tried the alternative way with pgfplots, as to be read in earlier posts of this topic - is there a reason not to use this but to stick to gnuplot? I would simply use pgfplots - no external program needed.

Stefan
LaTeX.org admin
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

Re: latex,gnuplot

Post by ditka »

Yes, pgf also needs gnuplot, and I think it is more efficient drawing graphs with gnuplot that pgf.
josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm

How can I draw plots in LaTeX?

Post by josephwright »

No, pgf does not need gnuplot to produce plots. I quite routinely use pgfplots to create plots for work, no gnuplot involved at all.
Joseph Wright
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

Re: latex,gnuplot

Post by ditka »

Yes I know some functions can be done without it, but when you want to draw graphs it is probably better if you use gnuplot.
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

Re: latex,gnuplot

Post by ditka »

I think latex is just not able to conect with gnuplot, and I dont have idea why.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

How can I draw plots in LaTeX?

Post by Stefan Kottwitz »

ditka wrote:Yes, pgf also needs gnuplot
I agree with Joseph: pgfplots doesn't need gnuplot. That makes it easier to use. Simple example, which I posted recently on matheplanet.com:

Code: Select all

\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
  \begin{axis}[axis x line=middle, axis y line=middle]
    \addplot[domain=0:5, samples=100, smooth] {1/sqrt(x)};
  \end{axis}
\end{tikzpicture}
\end{document}
plot.png
plot.png (3.44 KiB) Viewed 5618 times
ditka wrote:I think it is more efficient drawing graphs with gnuplot that pgf.
In the calculation during compilation, this may be true, though one may think about how efficient it is to call an external program many times, at each place where a plot is, producing another auxiliary file each. But for the final pdf it doesn't matter, once it's compiled.
ditka wrote:Yes I know some functions can be done without it, but when you want to draw graphs it is probably better if you use gnuplot.
This depends on what you define is better. I think it's better, to have a native LaTeX package which perfectly integrates with your document, regarding preamble settings and styles, such as consistency regarding font style and size and math mode in axis labels and the main text.

If compilation speed is so important that it's more worth than style consistency, or if gnuplot offers a feature which pgfplots doesn't, well, use it. But then it's a challenge for less experienced users to get it running.

Perhaps tell us reasons why gnuplot may be better, I'm interested to know. You already mentioned efficiency (though I guess you mean speed, but not disk space, plot data files cost space with gnuplot).

Stefan
LaTeX.org admin
User avatar
Stefan Kottwitz
Site Admin
Posts: 10321
Joined: Mon Mar 10, 2008 9:44 pm

How can I draw plots in LaTeX?

Post by Stefan Kottwitz »

ditka wrote:I think latex is just not able to conect with gnuplot, and I dont have idea why.
This can be an operating system issue. LaTeX just calls "gnuplot", so it has to be installed so that it can be called. For example, the executable file of gnuplot has to be in the PATH environment variable of Windows, where programs are searched. Test at the command prompt: call gnuplot at the command prompt (cmd). If it doesn't start there, then also LaTeX doesn't have a chance to find it.

Stefan
LaTeX.org admin
Post Reply