{pgfplots} is a package for creating 2D and 3D plots of mathematical functions and numerical data, using the PGF graphics framework. For questions about the inbuilt plotting functionality of TikZ/PGF, use {tikz-pgf} instead.

learn more… | top users | synonyms

18
votes
1answer
7k views

How do you remove the axis multiplier?

A chart with data in the range of 200,000 and small difference between max and min values, will be assigned a 10^5 multiplier to the entire axis. This results in the ticks becoming meaningless, since ...
13
votes
2answers
3k views

Using a pgfplots-style legend in a plain-old tikzpicture

I am using a plain-old tikzpicture to produce a pie-chart-like plot. Now, all other plots in my paper are handled using pgfplots (which doesn't do pie charts) and have their legend typeset by ...
32
votes
2answers
3k views

Axis break in pgfplots

Is there an easy way to 'break' the axis in a pgfplots environment? What I'm talking about is something like this Any minimal plot will do as an example...for example \documentclass{minimal} ...
32
votes
2answers
3k views

Drawing heatmaps using TikZ

Introduction I want to create a heatmap using TikZ. You can see the basic idea in the picture below: I basically have a table of values and each value is assigned a color. The picture is the result ...
30
votes
2answers
5k views

How can I add a zero line to a plot?

I frequently need to draw a horizontal or vertical line passing through the axis origin that spans the entire width or height of my plot area. I don't want to use axis lines=middle, because the tick ...
12
votes
1answer
1k views

Intersections in PGFplots

I can get intersections to work in TikZ, but not PGF plots. I defined a command to show the intersections to make sure that it is identical in both cases. Commenting out the \ShowIntersection line in ...
55
votes
5answers
20k views

How to expand TeX's “main memory size”? (pgfplots memory overload)

I'm compiling one pretty simple LaTeX file with few dozen of pgfplots. Now, I can compile part by part, but am unable to compile it all at once. I really need good precision for all those plots (noise ...
21
votes
2answers
3k views

PGFplots foreach equivalent to TikZ's with multiple variables separated by a slash

I like TikZ's capability to traverse multiple variables separated by a slash in the foreach (as in the example below). I am looking for something equivalent in PGFplots? I saw in the documentation ...
39
votes
3answers
11k views

pgfplots: how can I scale to text width?

This question led to a new package: tikzscale When I try to scale a plot with: width=\textwidth there is some horizontal space between the start/end of the plot and the start/end of the ...
9
votes
1answer
1k views

Is it possible to change the color of a single bar when the bar plot is based on symbolic values?

I am beginner in LaTeX, trying to use it for industrial documents. I wonder if there is a way to change the color of only one bar of the plot below, ie "TestDetails", to illustrate it is a local macro ...
8
votes
1answer
1k views

Using pgfplots, how do I arrange my data matrix for a surface plot so that each cell in the matrix is plotted as a square?

I have a matrix of size MxN and I want to make a surface plot directly from above so that each cell in the matrix is drawn as a square. None of the pgfplots shaders really do what I want, since they ...
36
votes
3answers
9k views

Pgfplots: how to fill the area under a curve with oblique lines (hatching) as a pattern?

I want to hatch the area under a curve (graph of a function) with oblique lines on an interval (to illustrate the function's integral on that interval). This can be done elegantly in gnuplot... ...
45
votes
4answers
6k views

3-dimensional histogram in pgfplots

I have a simple 3d histogram which I want to import into pgfplots, e.g. using matlab2tikz or by hand. PGFplots does not offer 3d histograms. Is there an easy way to do this?
20
votes
1answer
3k views

pgfplots: Placing node on a specific x-position

I'm trying to put some arrows on the left and right side of the maximum of a curve. The arrows should point along the curve. My problem is that if I use the [pos=X] notation I don't know where I am in ...
237
votes
2answers
27k 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
9k 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.
25
votes
3answers
2k views

Is there an easy way of using line thickness as error indicator in a plot?

I have several curves/datasets (obtained from Monte Carlo simulations) with x-dependent y errors I would like to plot with the errors somehow indicated. Since each curve consists of quite a large ...
30
votes
2answers
4k views

What is the clearest way to graph a piecewise function?

I have a function defined as: How can I graph that using functions instead of coordinates? I'm currently working with pgfplots but I'm open to something else if it's better.
11
votes
1answer
7k views

Legend in tikzpicture

I am looking for a way to create a legend in a regular tikzpicture. I found this Using a pgfplots-style legend in a plain-old tikzpicture but I don't know how to put the legend at the wanted ...
18
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 ...
16
votes
1answer
3k views

pgfplots: externalization and legend referencing

There are some issues when using the pgfplots option legend to name together with externalization. When I disable externalization, everything works fine. When I enable externalization, I get an error ...
35
votes
2answers
10k views

Label plots in pgfplots without entering coordinates manually

I like to label my plots directly, i.e. without using a legend, but instead using a pin node. So far, I have added the labels with manually specified coordinates, which means trial-and-error for data ...
20
votes
3answers
1k views

Draft mode for pgfplots

I'm working on a fairly big document that has a lot of graphs of functions- so far it has around 200, by the end it will have around 1500. I use pgfplots for each graphic, and the functions are pretty ...
13
votes
1answer
2k views

Defining a Piecewise Function for PGFplots

I want to define a piecewise function q(x), and attempted to adapt the solution to this question on using pgfmathdeclarefunction to create a unit pulse function, and this works fine. However, when I ...
11
votes
1answer
1k views

Creating Bezier surfaces using procedural graphics

Are there any package for LaTeX that can create Bezier surfaces? I mean a actual existing function that takes matrices as arguments and generates the surface, not a function written by myself.
20
votes
2answers
4k 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 ...
12
votes
1answer
3k views

Non-linear curve fitting with gnuplot

I am trying to use gnuplot with pgfplots in TexShop, following on from an example by Martin H in the comments here. I can get the data points in OK, and plot them but the fit (red line) does not seem ...
22
votes
1answer
3k views

How can I adjust the horizontal spacing between legend entries in PGFPlots?

I am using legend columns=-1 to make a horizontal legend. However, the distance between the individual legend entries is too small for my taste. Is there a straightforward way to increase the ...
11
votes
1answer
3k views

Axis with trigonometric labels in PGFPlots

How do I make the axis labels use multiples of \pi in PGFPlots?
6
votes
5answers
3k views

How do I use pgfmathdeclarefunction to create define a new pgf function?

I'd like to define new function for pgf so I can use it in pgfplots. I'm trying to create a unit pulse function p(x) which has a value of 1 from x=0 to x=1, and 0 elsewhere. I read the pgf manual on ...
7
votes
1answer
476 views

Is there a way to clear paths previously defined with name path global in TikZ

In the solution to Intersections in PGFplots it was pointed out that each \addplot command was drawn in its own scope and using name path would not survive outside of that \addplot command. The ...
36
votes
3answers
2k views

Replicate the Fourier transform time-frequency domains correspondence illustration using TikZ

The following time-frequency correspondence illustration is in the wikipedia entry of the Fourier transform. Also a gif animation version (if the animation doesn't show, please open the following ...
16
votes
3answers
4k views

Image with axis

I need to plot some data in a file (10000 records of 2 points each one) but PGFPlots is very very slow rendering it. So I'm trying to use MatLab to plot the data, capture the image without axis and in ...
16
votes
2answers
1k views

How to minimize the ink-to-data ratio for pgfplots

Tufte advocates to "minimize the ink-to-data ratio" for charts. I am trying to style a multi data series bar chart, that can have a grid and axes as shown below (chart at the left is from the ...
29
votes
2answers
10k views

number format in pgfplots axis

How can I change the type of the decimal/thousand separator from the american one to the european one? More precisely, I want: "1000" to be written as is, instead of "1,000" "0,1" instead of "0.1" ...
8
votes
1answer
2k views

How to access \xmin, \xmax, \ymin, \ymax from within PGFplots axis environment

In the MWE example below I have the values specified twice, but would prefer not to have to do that. Furthermore, it is possible to allow PGFplots to automatically select these end points so I would ...
6
votes
1answer
4k views

PGFplot to occupy full \linewidth, and aligned y=axis across tikzpicture

How do I get the tikzpicture to occupy the full \linewidth, and also have the left and right axis aligned? I suspect that some \phantom spacing applied to the tick labels will do the trick, but don't ...
15
votes
2answers
5k views

Need to do some changes to pgfplots axis

I am still in the habit of learning TikZ, barely started using pgfplots to create my images Although I am still not sure what the best way to do so is, I need to create the image below. My problems ...
15
votes
1answer
2k views

Smooth option sometimes produces incorrect arrow tips in PGFplots

It seems that the smooth option applied to lines sometimes effects the arrow tips and produces incorrect results. No problem with vertical lines, but any other seems to have a problem. Is this a ...
10
votes
1answer
1k views

How can I mix an “ybar” and an “ybar stacked” with pgfplots?

I tried a while to create that kind of chart with ybar but it's a mix between "ybar stacked" and "ybar". How can I do that? I tried this way but with no great results: \begin{tikzpicture} ...
11
votes
1answer
4k views

pgfplots - number format on axis

How can I force pgfplots to draw my axis ticks labels consistently? I mean instead of 0 a 0.0, instead of 1 a 1.0 in the below image. EDIT: Code \documentclass[a4paper,10pt]{scrartcl} ...
11
votes
2answers
2k views

Coordinates of intersections

In axis environment I have a curve and a line intersecting it. How can I get components of intersection-1, intersection-2 etc. in axis units? \documentclass{minimal} \usepackage{pgfplots} ...
11
votes
1answer
1k views

Consistently specify a Function and use it for computation and plotting

I would like to be able to specify a mathematical function and be able to use that for multiple purposes including: Computation of values (see bullet points below) Graphing using pgfplot Graphing ...
8
votes
1answer
3k views

Boxplot in LaTeX

I am new to LaTeX. How can I draw a boxplot in LaTeX. My data set is as below index median box_top box_bottom whisker_top whisker_bottom 0 1 1.2 0.4 1.5 0.2 1 2 2.3 1.5 2.7 1 2 0.7 1.4 0.5 1.9 0.1 ...
6
votes
2answers
5k views

tikz legend in caption

I have adapted a piece of code that I found on the Q&A forum multiple legends in pgfplots as follows in order to include the legend of a drawing directly into the caption: EDIT 1 ...
7
votes
1answer
3k 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 ...
7
votes
2answers
320 views

How to emphasize within a listing two successive identifiers separated by a space?

I have this pgfplots code that I want to put in a lstlisting environment: \pgfplotsset{ every axis x label/.append style = { font = \small }, every axis y label/.append style = { ...
6
votes
1answer
2k views

pgfplots: Multiple (shifted) stacked plots in one diagram

How can I get multiple stacked plots (ybar stacked, stack plots=y) in one diagram, such that there are multiple stacked bars for the same x-coordinate, each slightly shifted? Is there a way to reset ...
11
votes
2answers
668 views

Unexpected clash between babel and pgf spy

The following example taken from the pgfplots manual (p. 121) works fine only if the line loading babel is commented \documentclass{article} \usepackage[frenchb]{babel} % this is the troubelsome ...
37
votes
3answers
2k views

Is there a package that provides graphing in the style of Ed Tufte?

I have recently started using the tufte-latex package for various science writing and, while I love the package generally, am dismayed that it does not include the ability to produce graphics (charts, ...