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

How can I draw plots in LaTeX?

Post by ditka »

I have tried to download and typsett the following document:

http://www.texample.net/tikz/examples/gnuplot-basics/

The picture I get looks like this:

Why there is no graphs?
Attachments
untitledfkskflgdsd.JPG
untitledfkskflgdsd.JPG (7.05 KiB) Viewed 7740 times

Recommended reading 2024:

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

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

User avatar
Stefan Kottwitz
Site Admin
Posts: 10324
Joined: Mon Mar 10, 2008 9:44 pm

How can I draw plots in LaTeX?

Post by Stefan Kottwitz »

This example requires:
  • gnuplot has to be installed
  • --shell-escape or --enable-write18 has to be used
Get gnuplot from here. Well, I used Linux where installing it is much easier. I just typed

Code: Select all

sudo apt-get install gnuplot
Configure your editor to use the shell-escape feature, so it's able to run external programs. I can tell you how it's done in TeXworks, which I'm using.

This is my output:
gnuplot.png
gnuplot.png (7.33 KiB) Viewed 7737 times
Stefan
LaTeX.org admin
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

Re: latex,gnuplot

Post by ditka »

I have gnuplot on my computer.

What does this mean:


--shell-escape or --enable-write18 has to be used

Shoud I type this somewere or is it some setting?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

How can I draw plots in LaTeX?

Post by localghost »

These are command line options for the compiler engine which allow to invoke external programs.
  • -shell-escape is the parameter when using TeX Live
  • --enable-write18 is the parameter when using MiKTeX
You need to add these command line parameters in the corresponding settings of your LaTeX editor. For details refer to its documentation.

Since you are using PCTeX, you have to find out what parameter is accepted by your compiler engine(s). Open a command line any type this line.

Code: Select all

latex --help
The output should be a list with allowed parameters.


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

How can I draw plots in LaTeX?

Post by ditka »

You need to add these command line parameters in the corresponding settings of your LaTeX editor.
How exactly I do that?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: latex,gnuplot

Post by localghost »

How are we supposed to know that if you don't tell us which editor you are using? Please provide useful information independently and not only on demand. m(
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

Re: latex,gnuplot

Post by ditka »

I download MiKTex, and I wil try to do it there.
Is that what you meant?
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: latex,gnuplot

Post by localghost »

No. MiKTeX is a TeX distribution, not an editor. With what do you edit your source files (*.tex)?
ditka
Posts: 85
Joined: Fri Jul 13, 2012 11:59 am

Re: latex,gnuplot

Post by ditka »

Where can I see that? :oops:
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Re: latex,gnuplot

Post by localghost »

Do you want to say that you can't tell us the name of your editor? m(
Post Reply