{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.
184
votes
2answers
19k 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 ...
33
votes
3answers
2k 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?
30
votes
3answers
8k 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 ...
28
votes
1answer
1k views
Plotting several 2d functions in a 3d graph
I am trying to reproduce a similar figure to the following one. My first guess was to use pgfplots but I didn't find any example that I could use as a starting point. At the moment I am unsure if ...
27
votes
3answers
4k 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 ...
26
votes
2answers
277 views
Align nodes containing numbers on the decimal separators
In a plot, I have several vertically distributed nodes containing numbers with different numbers of digits before and after the decimal separator, and a trailing percent sign.
I would like to align ...
26
votes
1answer
528 views
Polar histograms
I recently stumbled upon this post, that explains how to make polar histogramms with R. An improved version of R-package can be found here. Even though it looks unfamiliar, the result of is quite nice ...
26
votes
2answers
1k 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 ...
24
votes
2answers
1k 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.
23
votes
1answer
4k views
Bell Curve/Gaussian Function 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.
23
votes
2answers
4k 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 ...
22
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, ...
21
votes
4answers
886 views
How to draw the region of inequality?
Everyone, I would like to draw the region
\begin{align*}
x_1 + x_2 &\ge 3 \\
2x_1 - x_2 &\le 5 \\
-x_1 + 2x_2 &\le 3
\end{align*}
Here is my code to draw the region of inequality:
...
21
votes
1answer
380 views
Does pgfplots support “spatial” plotting?
As the title states, I like to know if I can plot "spatial" with pgfplots. And I think I have to explain what I mean by that (I couldn't find a good expression in english):
In a pgfplots 3d plot, ...
20
votes
3answers
920 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
3answers
506 views
Isometric Elevation Grid in TikZ
Is there a (simplistic?) way to draw a 3D elevation grid like this in Tikz or PGFPlots?
The blue line should be able to move up or down and, eventually, submerge the interior blocks.
I've looked ...
20
votes
1answer
2k views
TikZ: How to get a few smooth grid lines for surface plots
I want to produce smooth surface plots with smooth grid lines using TikZ/pgfplots. Usually, this can be achieved using e.g. [samples=100], but this also draws 100 grid lines. I basically want that
...
19
votes
5answers
3k views
Can I use pgfplots to make a boxplot
My current plotting tool for my papers is pgfplots for nice consistent plots. Now I would like to add a boxplot. Is this possible with help of pgfplots, or any helper package?
19
votes
2answers
4k 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...
...
18
votes
3answers
2k views
How to design a 3D donut pie chart with pgf-plot?
It seems that pgfplots users don't like pie charts but sometimes we can't go without (for some reasons). So I was wondering if there was a way to make what is called a donut chart.
For example one ...
18
votes
2answers
1k views
Making overlay figures in TikZ
I'm trying to reproduce the following two figures in TikZ.
My attempted code for Fig 1 is
\documentclass{minimal}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw ...
18
votes
2answers
1k 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}
...
18
votes
2answers
2k views
filling area between 2 functions, with shading
I would like to plot two (rather simple) functions f, g over domain -2:2 and fill the area between them. The fill color should be red if f > g and green if f < g (for example), and in later ...
18
votes
2answers
3k 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"
...
18
votes
3answers
518 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 ...
17
votes
1answer
1k views
How can I draw a chart in the economist style with pgfplots?
I am trying to draw a chart with "The Economist" style.
With tikz, I draw this chart clumsily, so I would like to know is that possible to draw this chart elegantly with pgfplots.
...
17
votes
2answers
806 views
Highlighting Extremal Values in Table
In a table generated by pgfplotstable, how can I highlight for each column or row the cell with the minimum value (e. g. displaying the corresponding entry in bold face)?
Example:
17
votes
1answer
2k 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 ...
16
votes
5answers
1k views
Lower and upper Riemann sums
I am trying to create a few images for educational purposes. Therefore I need to be able to illustrate the area under various functions, using lower and upper riemann sums (rectangles)
Reason for not ...
16
votes
1answer
347 views
GitHub-like punchcard with the help of pgfplots
Is it possible to create a punchcard so it will look like the same on GitHub with the help of pgfplots?
The data stored in punchcard.dat:
0 Monday 18
1 Monday 67
2 Monday 62
<hour> <day> ...
16
votes
1answer
228 views
Consistant formatting with siunitx and pgf: Thousands Separator
I like the default behavior of the siunitx package in that the thousands separator is not applied to four digit numbers, but is applied when the number of digits exceeds four. In documents that ...
16
votes
1answer
718 views
How can I draw a vector field (quiver plot) on a surface in 3D?
I'd like to draw a vector field on a torus using PGFPlots and/or TikZ. I managed to do it using ePiX, based on the file decorate.xp from the example gallery, but then I have to do z-sorting by hand, ...
15
votes
2answers
2k 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 ...
15
votes
3answers
3k views
Aligning subplots in a pgfplots figure
I have the following figure (a very, very stripped down version of a figure I created using matlab2tikz)
My problem is that the subplots are not aligned correctly due to the fact that the y axis ...
15
votes
1answer
837 views
Fill the area determined by two pgfplots graphs
I need to fill the region determined by two (Gaussian) curves and the right red line (the region is brushed in green in the figure below). I also wonder what is the best way to draw vertical line ...
15
votes
1answer
520 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 ...
15
votes
1answer
862 views
Waterfall Chart
For displaying the total effect of a series of values, a waterfall chart can be useful. For example this chart, taken from The Economist, illustrates estimated efficiency potentials in the UK public ...
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 ...
14
votes
1answer
718 views
Surface of Revolution
how to draw using surface of revolution tikz or pgfplots?
\documentclass{article}
\usepackage{tikz,pgfplots}
\begin{document}
\begin{tikzpicture}
\end{tikzpicture}
\end{document}
I am not able to ...
14
votes
1answer
364 views
How to plot integral as summation, as pictured?
I'm new to TikZ and pgfplots but would like to know how to plot the square as well as how to plot the arrows + delta x as well as arrow + delta A:
I'd be most grateful if some of you had some ...
14
votes
1answer
559 views
Intersection of two surfaces
I'm trying to create a signed distance function S(x), where I want to intersect S(x) = 0 with a plane. The problem is not to get the two functions into a plot, but to get the two functions to visual ...
14
votes
2answers
1k views
TikZ externalize, pgfplots and animate
I gave a very fetching presentation written with beamer today. It included a pgfplot animated with the animate package, and the result was fantastic. The problem? One of my colleagues wants to borrow ...
14
votes
1answer
1k views
How do I draw a plot with a variable line width in pgfplots?
I have highly dimensional data for which I'd like to draw a plot where I vary the line-width, somewhat similar to the famous Minard chart:
I suspect this can be done with some combination of point ...
14
votes
3answers
536 views
How to change only the last xticklabel?
I would like to set the last xticklabel to \infty. How can this be achieved without necessarily knowing the xtick value?
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
...
14
votes
1answer
620 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 ...
14
votes
2answers
330 views
Bar plots in sans serif font
I want to typeset my bar plots with a sans serif font (using LuaTeX). I tried many options that I found searching the manual and the internet. None of them solved my problem---using different fonts ...
13
votes
2answers
666 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 ...
13
votes
2answers
950 views
how to keep a 1:1 scale with x and y axis
I have been searching for hours now on how to fix these small problems, and I am finally admitting defeat and humbly ask for help. Lately I have been going over some of my badly drawn figures, trying ...
13
votes
2answers
3k views
How to combine fill and pattern in a pgfplot bar plot?
Is it possible to combine a TikZ pattern with a background of a chosen color?
\addplot[black,fill=yellow,pattern=north east lines] ...
yields bars which have black stripes on white (transparent?) ...
13
votes
1answer
3k 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 ...
