{plot} is for questions concerned with plotting data or functions using TeX. For questions specific to the pgfplots package, use the {pgfplots} tag.

learn more… | top users | synonyms

222
votes
2answers
24k views

Create xkcd style diagram in TeX

The unique style of the diagrams at xkcd has an informative but nice hand-drawn touch. I guess they are actually drawn by hand but just recently on our partner site for Mathematica someone asked how ...
38
votes
2answers
1k views

Draw polarized light

I was trying to draw something like that Searching through the net to see if it already exists in tikz I came accross in texample.net the following image which looks a lot like what I want to draw. ...
32
votes
1answer
7k views

Bell Curve/Gaussian Function/Normal Distribution in TikZ/PGF

Can anyone tell me how to plot a gaussian function/bell curve using TikZ/PGF? I'm basically looking to implement something like PSTricks's \psGauss command.
22
votes
3answers
2k views

How can I make plots with TikZ which look like the new Mathematica 9 plots

The new Mathematica 9 is out! I would love to know how to make similar plots to the one's advertized, particularly the following: and Here is a simple plot to get started. %& -shell-escape ...
20
votes
2answers
3k views

Fill between two curves in pgfplots.

How to accomplish fill between two curves in pgfplots? For example, I have ... \addplot coordinates {(0,1) (1,1)}; \addplot file {something.dat}; ... and I would like to have filling between those ...
19
votes
8answers
753 views

Plotting Weierstrass function

I'm trying to plot Weierstrass function using only basic TikZ picture functionality (no gnuplot or whatnot). How do I use sum in a \draw? Do I have to make a new command? Use a loop? An alternative ...
17
votes
1answer
969 views

Drawing timeline

I have a dataset which consists of repeating events over time. Each event takes an arbitrary amount of time. I could plot this using gnuplot but am unable to produce correct keys because of the ...
16
votes
4answers
3k views

Fill the area between two curves calculated by pgfplots

This is essentially the same question as fill the area between two curves when their coordinates are known. In that question, the curves were defined by known coordinates. I want to fill the area ...
16
votes
2answers
772 views

How can I produce a graph from a table?

What I want to do is plot a graph for a given data set. This must be simple to do, but I just cannot find a simple explanation of how to do it... I have the following table (no problem so far): ...
15
votes
2answers
2k views

Animated plotting with LaTex?

I am not a LaTeX pro, that's why I don't know if the following is possible and how I could do it. I have a graphic (a plot, jpg) and it shows a time series. I know in PowerPoint it is possible that ...
15
votes
2answers
4k views

Is plotting exponential graphs a known source of bugs in TikZ?

I want to plot $y = 2^x$ over a small domain. Unfortunately, even though tikz (v 2.1) seems to be able to calculate 2^{negative numbers} it is not plotting them correctly. My minimal example is: ...
14
votes
5answers
837 views

How to plot x^(1/3)?

I tried to export my Geogebra graphs into tikz-code. In General it works fine, but plot x^1/3 doesn't work: \documentclass[10pt]{article} \usepackage{pgf,tikz} \usetikzlibrary{arrows} ...
14
votes
4answers
1k views

Plotting the solution of inequalities with WolframAlpha or Maple

I want to plot the solution of two inequalities and include them in a LaTeX paper. I really like they way this looks: Wolfram Alpha. Unfortunately, I have no idea how to export this into a ...
13
votes
2answers
393 views

Better way of embedding OpenOffice plots into LaTeX?

Right now, I create plots in the spreadsheet, copy them to OpenOffice Draw, save as images, and then put them (as images) into my .tex file. But that leads to problems with resolution (labels too ...
13
votes
1answer
2k views

Plotting an implicit function using pgfplots

What is the correct way to plot an implicit function using pgfplots? Consider the following example: \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} ...
12
votes
2answers
1k views

TikZ: How to draw a sine curve in 3D?

I know how to draw a sine curve in TikZ and I know how to rotate it in the plane of the paper. I would now like to draw a sine curve that oscillates in the depth of the paper - to give the impression ...
12
votes
2answers
2k views

Plot reciprocal function with tkiz

I need to plot f(x) = 1 / x in LaTeX and am trying to with Tikz. I haven't found a way to set the vertical range, so the values go out of bound around x=0. Using gnuplot directly doesn't seem to be ...
12
votes
2answers
1k views

Floor function plot with TikZ

I can't seem to figure out why, but TikZ isn't properly plotting the floor function. Here is my code: \begin{tikzpicture}[xscale=1,yscale=1] \draw[step=.5cm,gray,very thin] (0,0) grid (8,8); ...
11
votes
2answers
2k views

inset plot with pgfplots

I am using pgfplots to plot some data I have, and I wanted to generate a large plot with another plot inside of it, showing a zoom on a region of the large plot. I have noticed that when you do ...
11
votes
1answer
228 views

Join two function-based curves in Tikz

I have the following: \begin{tikzpicture}[line cap=round,line join=round] \draw[dashed,domain=0:9,samples=20] plot (\x,{1/(\x+.5)+3}); \draw[dashed,domain=0:9,samples=20] plot (\x,-{1/(\x+.5)+2}); ...
10
votes
4answers
947 views

What is the easiest way to plot a function and its tangent lines at the turning points?

I want to plot graphs like this and embed them as Tikz or Pstricks code in my handouts. I know that there are software such as Ipe, LaTeXDraw etc. But none of them can satisfy me. Because Ipe doesn't ...
10
votes
3answers
5k views

draw a plot with point

i try to draw something like this : to do that i have write some code using tikz,unfortunately i dont get what i want \documentclass{report} \usepackage{tikz} \usetikzlibrary{automata,topaths} ...
10
votes
1answer
240 views

Problem with legend in pgfplots

I want to make plot with fill area. I try this code \documentclass[a4paper,12pt]{report} \usepackage{pgfplots} \definecolor{plotmain}{HTML}{97bbcd} \pgfplotsset{every axis legend/.append ...
10
votes
1answer
163 views

Why (\x)^2 and \x^2 produce different results in Tikz plot? [duplicate]

(\x)^2 will plot correct parabola, while \x^2 will have negative x branch upside down. Why () are required for this formula to work? \documentclass[10pt]{article} \usepackage[utf8]{inputenc} ...
10
votes
2answers
4k views

How to plot data from a CSV file using tikz and csvsimple?

Here is a minimal example : \begin{filecontents*}{data.csv} a,b,c,d 1,4,5,1 2,3,1,5 3,5,6,1 4,1,4,9 5,3,4,7 \end{filecontents*} \documentclass{article} \usepackage[utf8]{inputenc} ...
10
votes
1answer
852 views

Plot non-continuous function with TikZ

How can I plot a non-continuous function with TikZ (using continuous lines for continous stretches of the function and dashed lines for discontinuities)? Does anybody know an efficient method?
10
votes
1answer
872 views

TikZ: Fill (closed) parametric plot of catacaustic

Is there a trick to fill the parametric plot of a catacaustic which looks closed but isn’t closed in TiKZ meaning. The Problem is the egdge which looks closed but isn’t it … I guess I can ...
9
votes
4answers
1k views

How to plot atan(x), sqrt(x) using PSTricks?

For example, this code works: \documentclass{minimal} \usepackage{pstricks} \usepackage{pst-plot} \begin{document} \begin{pspicture}(-5,-5)(5,5) \psgrid[griddots=10,gridlabels=0pt, subgriddiv=0, ...
9
votes
3answers
380 views

How to draw two intersecting graphs?

I want to make the following figure. My efforts are: \documentclass{standalone} \usepackage{pgfplots} \usetikzlibrary{calc,shadings} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} ...
9
votes
2answers
483 views

plot 3d graphs of functions defined implicitly

How can I plot 3d graphs of functions defined implicitly (quadratic forms, for Linear Algebra course notes -- I'd like to include lots of examples)? As far as I can see it is not possible with ...
9
votes
2answers
514 views

pgfplots plots function not correct

This code \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \begin{axis} \addplot [domain=15:30, samples=1000] ...
9
votes
3answers
514 views

How can I make circle plots?

I have not idea how to call these things, but I just saw a paper with the following figure and I was wondering how one would go about doing it in LaTeX. The closest thing I saw on TeXample.net was ...
9
votes
1answer
436 views

Curve synthesis - Adding two curves to get another one

Case 1: Let's say I have a few coordinates (A), (B), (C), (W), (X), (Y), and (Z) (possibily obtained through intersection, rotation, and whatnots). I draw two piecewise linear curves through (A), ...
9
votes
1answer
1k views

pgfplots - Placing Nodes on x Coordinates of a Plot

I want to plot some graphs in pgfplots and want to place nodes on the exact same x coordinate of the plot. The position of the note has to be set in x direction but free in y direction. Here is one ...
9
votes
1answer
476 views

Using pgfplots with a0poster

I want to use tikz/pgf to plot some graphs in a poster done with a0poster. That is the code: \begin{tikzpicture} \begin{axis}[xlabel=lambda, ylabel=int] \addplot[blue] table [mark=none, col ...
8
votes
2answers
425 views

Drawing spherical harmonics with pst-3dplot

For my lecture notes in theoretical physics (namely quantum mechanics) I'm trying to visualize the spherical harmonics. I got Mathematica to plot them an this is what I did: ...
8
votes
1answer
274 views

plotting the sequence x_n using tikz

I want to plot the sequence x_1 = \sin(pi root(2)) x_2 = \sin(pi root(6)) x_3 = \sin(pi root(12)) In short my x_n = sin( pi root(n^2 + n)). I want to plot this as an animation as n goes to ...
8
votes
1answer
394 views

Tikz / pgfplot: plot Alternating Sequence

Is there any possibility to plot an alternating sequence? Picture: Alternating sequence: I don't need exacly the same output as above. I tried the following: \begin{tikzpicture} \begin{axis}[ ...
8
votes
1answer
108 views

pgfplots: wrong domain, wrong axis, uncentered graph… is it a bug?

Question I get a very strange graph with pgfplots, see the picture below. What is going wrong? Code and picture \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} ...
8
votes
1answer
331 views

how to draw plots without data in tikz?

I want to draw this plot. I know how to do it with data. But here I don't have any data. And I want to draw this. How would I do it?
8
votes
1answer
245 views

Tikz plots distorted mark

Consider the following code: \documentclass{minimal} \usepackage{tikz} \usetikzlibrary{plotmarks} \begin{document} \tikz{\draw (0,0) -- plot[mark=o] (0.5,0) -- (1,0);} \end{document} It seems ...
8
votes
1answer
596 views

How to project a function over a 3D plane

When I looked up the method to express two variable functions as a sequence of intersecting horizontal planes, I thought to use PGFplots to construct a simple set of "slices" of a generic function ...
8
votes
1answer
633 views

Plot functions and their point of intersection

We are plotting three functions as follows \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[enlargelimits=false] \addplot[domain=0:1,blue] {(1-x)/5}; ...
8
votes
1answer
1k views

Pgfplots: plot graph inside table

I would like to plot a table with a graph inside it. I am trying to use this example as a guide. This is the current hand-constructed version. UPDATE: I don't have enough reputation to answer my ...
8
votes
1answer
675 views

Pgfplots contour gnuplot crazy labels

This is driving me mad. I am tryng to create some contour plots, but I get them full of labels, so that they are unreadable! I can't even see the lines or read the values because they are too much. I ...
8
votes
3answers
578 views

How to speed up a large plot?

I have a large plot. It is a big file and it renders slowly. What is the best method to slim it down without loosing to much of its visual properties ? I know that PDF and PS support cubic splines. ...
8
votes
1answer
293 views

proper tool for charts in tex

I have scanned data graphics in a large ms written in TeX (of course). For copyright reasons I need to redraw these. My publisher may (sadly) decide not to use my source directly, so will need access ...
8
votes
0answers
129 views

Is there a better way to display this information? [closed]

I have drawn this picture in tikz. Is there a more visually pleasing and intuitively appealing way of displaying this information? I feel what I have drawn is dull and boring. I have to include more ...
7
votes
5answers
1k views

How can I draw dirac deltas with arrow heads with pgfplots

I would like to draw this in pgfplots: I've tried this, but I can't figure out how to get the arrowheads. \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} ...
7
votes
2answers
1k views

Easy creation of logarithmic grid with TikZ

Is it possible to create a logarithmic grid using the command below with TikZ? \draw (-0.1,-0.1) grid (4.1,4.1); It would be great to be able to create a logarithmic grid without having to specify ...