{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.
6
votes
1answer
713 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 ...
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 ...
7
votes
1answer
952 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 ...
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 ...
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 ...
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 ...
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?
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 ...
9
votes
1answer
1k 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 ...
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}
...
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 ...
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 ...
13
votes
2answers
663 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 ...
11
votes
3answers
2k 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 ...
5
votes
1answer
1k 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 ...
8
votes
1answer
1k 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
...
4
votes
5answers
2k 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 ...
10
votes
3answers
1k views
Use macro as coordinate in pgfplots plot
I'm trying to come up with a solution to the question How to maintain consistency with TikZ and Pgfplots?. Essentially, what is needed is a way to save a coordinate as a macro (or a global key, ...
12
votes
1answer
1k 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 ...
7
votes
1answer
969 views
plot within a plot: zoom into a plot so that the magnified part is framed by axis with ticks and tick labels
I want to zoom into a plot much like it is possible by using the spy library but I want the spy-in node to contain its own ticks and tick labels with a finer grid than the original plot. To clarify ...
4
votes
1answer
2k 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 ...
10
votes
1answer
711 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 ...
6
votes
2answers
3k 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
...
13
votes
1answer
1k 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 ...
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
517 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 ...
9
votes
2answers
700 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 ...
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"
...
13
votes
1answer
572 views
Use first row of a table as legend entry in pgfplot graph?
I'm using pgfplots extensively and I'd like to avoid having to write legends every time, since all the text files I want to plot have explicit headers.
As a comparison, \pgfplotstabletypeset makes a ...
8
votes
1answer
591 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}
...
10
votes
2answers
950 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}
...
10
votes
1answer
400 views
Tabs in output file written by xelatex and pdflatex are different
I'm trying out pgfplots with gnuplot to generate the data. This works by having pgfplots write some stuff to an external file, run gnuplot on the file, and then use the generated data to plot the ...
6
votes
1answer
1k views
Axis with trigonometric labels in PGFPlots
How do I make the axis labels use multiples of \pi in PGFPlots?
4
votes
1answer
1k 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 ...
6
votes
1answer
1k 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 ...
5
votes
1answer
417 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 ...
3
votes
1answer
326 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 ...
3
votes
1answer
644 views
pgfplots, custom legend and tikz library external
I try to create Tikz figure with several pgfplots subplots. I want to have one legend for them since they all have the same curves. I found out from this question that i can label and than reference ...
1
vote
1answer
597 views
Using Macro Defined Lists in TikZ/PGFplots
I want to be able to use a macro to specify a list (it is a constant list, i.e. will not change throughout the document) and use this macro rather than hard code the list contents in the TikZ/PGFplots ...
8
votes
1answer
621 views
Different scales on the same plot
I would like to know whether and how the pgfplots package can be used to produce a plot with two curves using different scales, like in the following example:
6
votes
1answer
278 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 ...
183
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 ...
11
votes
2answers
842 views
pgfplots: mark max/min value of a function
How can I mark the maximum or minimum value of a function like x^2 in pgfplots?
\begin{tikzpicture}
\begin{axis}
\addplot+[mark=none] plot {x^2};
\end{axis}
\end{tikzpicture}
13
votes
1answer
2k views
How can I change the font family in pgfplots?
I am using the classicthesis package in LyX to typeset my thesis. I have a plot produced with pgfplots. It uses math fonts same as elsewhere in the text, which is inconsistent with other plots of mine ...
11
votes
2answers
1k views
How to maintain consistency with TikZ and Pgfplots?
I would like to maintain some consistency between TikZ and PGFplots, and have run into numerous difficulties. Here is an example of two of them:
I would like to be able to use something similar to ...
14
votes
1answer
506 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 ...
10
votes
1answer
2k views
multiple legends in pgfplot
The problem: I have plots with 8 lines, and need to put the legend for all 8 lines into the plot. The document format is IEEE, and the plots need to fit in the single column.
The current solution: ...
9
votes
2answers
2k views
Image with axis
I need to plot some data in a file (10000 records of 2 points each one) but PGFPlot is very very slow rendering it. So I'm trying to use MatLab to plot the data, capture the image WITHOUT axis and in ...