Graphics, Figures & Tables ⇒ Invoke Gnuplot by the Compiler
Invoke Gnuplot by the Compiler
Thanx for answers.
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Re: Invoke Gnuplot by the Compiler
Thorsten
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Invoke Gnuplot by the Compiler
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Invoke Gnuplot by the Compiler
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Invoke Gnuplot by the Compiler
Code: Select all
\begin{gnuplot}
plot sin(x)
\end{gnuplot}
Code: Select all
\begin{gnuplot}[terminal=hterminali]
plot sin(x)
\end{gnuplot}
Perhaps I shoud point out that, what I mean was to use gnuplot in a way like this:
Code: Select all
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\begin{tikzpicture}[domain=0:4]
\draw[color=blue] plot[id=sin] function{sin(x)}
\end{tikzpicture}
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Invoke Gnuplot by the Compiler
Code: Select all
\documentclass[11pt]{standalone}
\usepackage[T1]{fontenc}
\usepackage{pgfplots}
\usepgfplotslibrary{polar}
\pagestyle{empty}
\begin{document}
\begin{tikzpicture}
\begin{polaraxis}
\addplot+[mark=none,domain=0:360,samples=100]{sin(x)};
\end{polaraxis}
\end{tikzpicture}
\end{document}
- Attachments
-
- The resulting output.
- pgfplots-sin-polar.png (24.48 KiB) Viewed 5787 times
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 34
- Joined: Sun Oct 16, 2011 5:56 pm
Re: Invoke Gnuplot by the Compiler
If you follow along the suggestion of localghost and consider using pgfplots, you might not need gnuplot at all.
In fact, pgfplots can do polar axes, function sampling, 3D plots (line, scatter, mesh, surface, patch, quiver, and some more) without ever calling gnuplot (as in the example of localghost). Consequently, you do not need to have gnuplot available for pgfplots. It can call gnuplot to sample functions, although it does a quite good job of sampling functions on its own. The only exception is 3d contour plots: pgfplots cannot compute contour lines on its own and will call gnuplot for intermediate results. It will generate contour plots on its own, however.
If you want to find out if that is suitable for your needs, you may want to browse through the many examples of the pgfplots manual on http://pgfplots.sourceforge.net/ . We can certainly help you if you run into problems with some specific example of using pgfplots.
Best regards
Christian
Re: Invoke Gnuplot by the Compiler
And is it possibly to draw the picture os that you post it(sin(x)) without any circles(except one that is graph of curve), in "normal" coordinate system?
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
Invoke Gnuplot by the Compiler
Actually the package manual shows very clearly how to set up plots.ditka wrote:Pgf plots is apparenty quite powerful , but what bother me is that I can not manipulate with coodinate axis(add labels x,y,colour, lenght of both axes,...) and with coordinate system. […]
A polar plot in Cartesian coordinates makes no sense. Correct me when I'm wrong, but you explicitly asked for polar plots.ditka wrote:[…] And is it possibly to draw the picture os that you post it(sin(x)) without any circles(except one that is graph of curve), in "normal" coordinate system?
So you better clarify what you really want. If you want a sine curve in Cartesian coordinates (wave), then you should read Section 19.5 of the excellent pgf/tikZ manual to learn more about that.ditka wrote:I would like to know, is it possible to call Gnuplot form LaTeX to create any sorts of plots that Gnuplot can do (polar coordinates, 3D,...) […]
Code: Select all
\documentclass[11pt]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[domain=0:6.28]
\draw[color=blue] plot (\x,{sin(\x r)});
\end{tikzpicture}
\end{document}
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
Re: Invoke Gnuplot by the Compiler
Nevertheless, the basic idea was, how to call gnuplot, for other functions, rahter than simle ones like type f(x)= something, sice, like I alredy mentioned gnuplot on its own can plot a lot things.