{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

227
votes
2answers
25k 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 ...
40
votes
2answers
2k 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. ...
35
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.
34
votes
2answers
1k views

How can I draw nomograms in LaTeX?

What is a nomogram “A nomogram, also called a nomograph, alignment chart or abaque, is a graphical calculating device, a two-dimensional diagram designed to allow the approximate graphical ...
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
869 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
4answers
4k 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 ...
17
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 ...
17
votes
1answer
1k 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 ...
17
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: ...
16
votes
2answers
804 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): ...
14
votes
5answers
1k 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
2k 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
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 ...
13
votes
2answers
454 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
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 ...
13
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); ...
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
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
6k 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} ...
12
votes
1answer
1k 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?
11
votes
1answer
265 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 ...
11
votes
1answer
243 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}); ...
11
votes
1answer
2k 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 ...
10
votes
4answers
1k 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
4answers
2k 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, ...
10
votes
3answers
7k 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
2answers
586 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 ...
10
votes
1answer
385 views

Draw a spiral on a sphere

My goal is to visualize damped magnetic precession. Wikipedia features an image, but it doesn't quite capture one essential constraint. Namely, that the magnetization M should be normalized. So the ...
10
votes
3answers
564 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 ...
10
votes
1answer
192 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
1answer
937 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
3answers
466 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
578 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
193 views

How can I move a single node in a tikz plot?

I can't find an answer online, please help me. The following plot shows the percentage of 3 groups. The red line is the average (and needs to stay at 13.8). How can I move ONLY the node "2.9" a ...
9
votes
1answer
1k views

How to have linked axes on plots?

I plot infrared spectra in many reports and I display the energy units in two ways, wavenumbers $cm^{-1}$ on the bottom x-axis and wavelength (nm) on the upper x-axis. The relationship is ...
9
votes
1answer
474 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
730 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}; ...
9
votes
1answer
499 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
3answers
531 views

Create heatmap with PSTricks or TikZ

I have a huge amount of 2D-coordinates, associated with a value, e.g.: x | y | value 27.50 52.15 12.51 61.83 13.32 57.56 36.23 21.83 41.73 40.46 85.67 25.20 ... The data is ...
8
votes
2answers
473 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
340 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
430 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
140 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
337 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
261 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
871 views

Problem with a TikZ/Geogebra plot of an exponential function (even if using CVS version definition)

I wanted to graph the function f(x)=(-1+4x^2)*e^2 in a coordinate system. Using "Export Graphics View as pgf/TikZ" in Geogebra I got the following code (here shown after I did some minor changes ...
8
votes
1answer
1k views

How to generate stem plots with TikZ like stem() in Matlab?

Given a set of (x,y) coordinates stored in a file, how could I generate a stem plot from those coordinates? I would like to achieve something similar as the matlab's stem function: ...
8
votes
1answer
685 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 ...