{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

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: ...
226
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 ...
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.
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 ...
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 ...
7
votes
1answer
2k views

Center nodes near coords in a stacked ybar plot

I'm trying to center the node values, at the middle of each bar, in a stacked plot. However I can only put those nodes in the top of each bar. Is it possible to move those down? To the center of each ...
9
votes
1answer
723 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}; ...
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 ...
8
votes
1answer
306 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
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
337 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 ...
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 ...
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 ...
11
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} ...
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 ...
7
votes
5answers
2k 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} ...
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 ...
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), ...
4
votes
4answers
2k views

Multiple subfigures not appearing on the same line

Multiple figures under a single caption. I have tried a code to put two images in a together under a same caption. The subfigures do not appear on the same line. The code is : ...
10
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
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} ...
7
votes
2answers
471 views

How to plot a discontinuous function curve and diagram of Markov chain with TikZ?

Please apologize my ingnorance of tips to use for asking questions. I would like to realise the plots and the diagram like those shown on page 158, 160 and 161 on this document Chaine de ...
5
votes
3answers
255 views

How do I draw graphs?

I'm new to Latex and I think I am going to use it for my physics classes in school. I have found a really good template: https://www.sharelatex.com/templates/journals/aip/ (I use sharelatex) which is ...
5
votes
1answer
1k views

TikZ plot: centering and units on axis

I have the following. I'm trying to center the plot and putting \begin{center} around the TikZ image does not work. Also I'm trying to change the units of the x-axis. The x-axis is used to ...
4
votes
2answers
3k views

Bar plot labels and grids

\documentclass[a4paper,11pt]{report} \usepackage{tikz} \usepackage{verbatim} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ title = {Optimalization based upon co-occurences}, ...
10
votes
2answers
581 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 ...
19
votes
8answers
867 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 ...
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} ...
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 ...
13
votes
2answers
452 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 ...
7
votes
5answers
1k views

Tangents to a circle from a point outside of it (tikz)

I'm trying to plot in TikZ the two tangents to a fixed circle passing through a given point. In some details, given an arbitrary circle centered at C with with radius r, and a point P outside of the ...
6
votes
2answers
458 views

Plot basic complex transformation in LaTeX

I want to first draw a shaded region on a xy-plane: 0≤x 0≤y≤π and then the image of the above region mapped onto a uv-plane by the transformation f=exp(z), i.e. the shaded region: ...
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 ...
8
votes
3answers
526 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
1answer
682 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 ...
7
votes
1answer
289 views

Huge table/matrix with colored boxes

I have a huge CSV file with about 25.5k records that (structurally) looks like the sample below. In essence, I want to display the values of the columns U,V,W,X,Y,Z of each row as a colored box. The ...
7
votes
3answers
709 views

Weird result plotting sin(x) using tikz/pgf [duplicate]

Trying to plot the sin(x) function, I get this result: The MWE is here: \documentclass{standalone} \usepackage{ pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} ...
6
votes
1answer
1k views

error bar colors in scatter plot

A data file contains four columns: x, y, error on y, class. class is an integer which I feed to scatter src so i get a graph that has different colors for different classes. However, the error bars ...
6
votes
3answers
1k views

Plot a matrix of real values with TikZ/PGF like imshow in matlab

How can I plot a matrix of real values with TikZ/PGF such that it looks like plotted with imshow in MATLAB? \addplot3 does something similar, but I'd like to have that in a color-coded 2D plot.
5
votes
4answers
392 views

How to plot a curve in a polar form r = f(Θ)?

Can we use LaTeX to make the graph of $\rho = \sec(\theta)$?
5
votes
2answers
296 views

How to plot the graph below?

May I know how to draw the graph as shown below? below is a code I have try but with look and feel that is quite far away from the example: \begin{tikzpicture} \begin{axis}[ legend pos=north ...
3
votes
1answer
267 views

Curve synthesis - Adding many (mostly piecewise linear) curves

It's a follow-up to a previous question. If I could have a macro out of the solution over there, it would have been great but then I couldn't make it. The following code (to be added to the one in ...
2
votes
1answer
707 views

Two color line in gnuplot

Is there any way to plot a line graph where each series is plotted with two alternating colors? For example, say I was plotting the population of bees over time and I wanted the line to alternate ...
1
vote
2answers
171 views

Multiple Plot query under a same caption with different labales problem [closed]

I have 6 figures and I want to plot them under a same caption with different labels. I have tried two codes for plotting but they are not working. Codes: \begin{figure}[htp] \centering ...
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] ...
6
votes
1answer
549 views

Labeling a function's plot generated by “plot function” [duplicate]

Possible Duplicate: How to label a path drawn using tikz with \draw plot? Consider plotting a parabola using the following code: \begin{scope}[domain=-2:2] ...
4
votes
1answer
123 views

Opacity for pst-3dplot object

How can the opacity of a pst-3dplot object be set to be transparent? I have an example where using opacity or strokeopacity options do not work. I am trying to make an image similar to the following: ...
3
votes
1answer
56 views

TikZ: Replacing the values (labels) on x-axis with names

I managed to create a simple linear plot with pgfplots-manual (chapter 4.5.1) Now I want to replace the values of x-axis (1,2,3,4) with text, e.g.Test A, Test B, Test C, Test D. How can I do such a ...
3
votes
1answer
226 views

tikz does not plot correctly

@Jake: this is the whole document \documentclass[11pt, a4paper]{book} \usepackage{amssymb} \usepackage{amsmath} \usepackage{amsthm} \usepackage{tikz} \usepackage{pgfplots} ...
3
votes
1answer
536 views

TikZ: plot datapoints with bars

I'm currently generating data files which have points as follows 5 1 3 2 2 1.4 ... Each line 2 values of which the first is indicating the time and the second some value. I'm currently (as I'm ...