Graphics, Figures & TablesInvoke Gnuplot by the Compiler

Information and discussion about graphics, figures & tables in LaTeX documents.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Invoke Gnuplot by the Compiler

Post by localghost »

So I again recommend gnuplottex and reading its manual. You will also have to read the Gnuplot manual to get familiar with its options.

As a start, look at this simple example. It will need current versions of gnuplottex as well as Gnuplot.

Code: Select all

% TeX program = pdflatex
\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[miktex]{gnuplottex}   % we use MiKTeX, see package manual

\begin{document}
  \begin{gnuplot}[terminal=pdf,terminaloptions=color enhanced]
    set samples 200
    set xrange [0:6.28]
    plot sin(x), cos(x)
  \end{gnuplot}
\end{document}
Please take a very close look at the mentioned manuals, especially to that of Gnuplot. Then you will learn quite quickly how to set up polar plots and other more complicated stuff.

And it is very much appreciated if you improve your written English. Your posts are sometimes really had to read and to understand (for a non-native reader).

Recommended reading 2024:

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

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

feuersaenger
Posts: 34
Joined: Sun Oct 16, 2011 5:56 pm

Invoke Gnuplot by the Compiler

Post by feuersaenger »

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.

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?
Hi ditka,

apparently, you are really after a gnuplot solution - so I suggest you go along the answer of localghost.

But since you asked these specific questions about pgfplots:
  1. add labels: YES (use 'xlabel=..., ylabel=..., title=...., legend entries=....)
  2. x,y: YES. see the \addplot command and its accepted input formats.
  3. colour: YES. pgfplots uses a colormap for scatter, mesh, surf, contour, and patch plots.
  4. length of both axes: YES. you can modify both the amount of space used "on paper" (using width and height keys) and the displayed limits (xmin,xmax, ymin,ymax).
  5. coordinate system: YES. polar axes have been shown already; cartesian as well. You can also provide polar coordinates in a cartesian axis and cartesian coordinates inside of a polar axis (using the data cs key). There are some more coordinate systems which appear to be out of scope here (like ternary axes and smithcharts).
  6. sin: YES. The command would be \addplot[red,domain=0:360] {sin(x)}; inside of a \begin{tikzpicture}\begin{axis} ... \end{axis}\end{tikzpicture}. The only special thing to care about is that it operates on degrees, not on radians. But you can convert from radians to degrees using the deg(x) function.
These answers are just for the records since you already said that you want to stick with gnuplot (which is fine).

Best regards

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

Invoke Gnuplot by the Compiler

Post by ditka »

If I use this option, just call gnuplot like that, I get the whole gnuplot picture in my output. But I dont want that, I want to plot coordiante system on my own, I just want to plot funtion(only) with gnuplot.(or pgfplots, if it can make equivalent structures.

To show what I mean:
In that very same coordiante system I want to put plot of some polar function(for example r=sin(theta) insted of sin(x).Is that possible?

Code: Select all

\documentclass{standalone}
\usepackage[latin1]{inputenc}
\usepackage{tikz}
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}[domain=-4:4]
    \draw[->] (-4,0) -- (4.2,0) node[right] {$x$};
    \draw[->] (0,-4) -- (0,4.2) node[above] {$f(x)$};
    \draw[color=blue] plot[id=sin] function{sin(x)}; 
\end{tikzpicture}
\end{document}

And I am really sorry for my linguistic problems,I hope you will understand what I want to say.
Attachments
fsfsfs.JPG
fsfsfs.JPG (7.11 KiB) Viewed 3294 times
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

Re: Invoke Gnuplot by the Compiler

Post by ditka »

Is it possible to just plot polar and parametric curves from gnuplot(without coorinate system)?
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

Re: Invoke Gnuplot by the Compiler

Post by ditka »

Is it possible to extract curve from any gnuplot or pgfplots(withoaut coordiante system)?
Post Reply