{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

3
votes
1answer
1k views

edit x-y data from different files/tables

I've two one column data files (A.txt and B.txt). To plot them together first I load dataA with \pgfplotstableset{ create on use/dataA/.style={create col/copy column from table={A.txt}{0}} } Then I ...
8
votes
1answer
441 views

Error when creating a surf plot with matlab2tikz

I'm using matlab2tikz to generate the tikz code for my figures. When compiling the document with the figure code as below, i get an error: Package pgfplots Error: No such element: ...
6
votes
1answer
447 views

Problem with external graphics and 3D pgfplots

I want to include an external graphics with pgfplots. I tried to follow the instructions of the manual (p45 et seq.) as carefully as possible. But the result is hoorible as hell. Here is the code I ...
5
votes
2answers
343 views

pgfplots: Clipping Everything Outside a Specific Area

I want to add information to each column of a histogram. every node near coord is probably the best approach. It works well with bar plots but not with the histogram: \documentclass{article} ...
5
votes
1answer
127 views

\foreach not behaving in axis environment

Am hesitant to ask yet one more embarrassing question, but I can't seem to see the problem with the \foreach in the MWE. It should produce several horizontal lines but only produces the one with the ...
5
votes
1answer
752 views

matlab2tikz imagesc TikZ/pgfplots equivalent

I'm using matlab2tikz to export imagesc figures into TikZ/pgfplots code. This process gives me a TikZ file and a rasterized png version of the image with colours matching the colourbar at the time of ...
4
votes
1answer
919 views

References in externalized pgfplots

I was writing on an document with a lot of pgfplots in it. Because of the memory limitation in LaTeX and in order to save some compiling time I tried out the externalize command. With most of the ...
4
votes
1answer
576 views

How to specify a name path for the axis in PGFplots

When I use the {axis} environment, the axis are drawn automatically so I am not able to specify a name for them? I would like to be able to compute intersections with the axis as in Intersections in ...
4
votes
1answer
366 views

How to define a parameterized command to be consumable in \pgfmathdeclarefunction?

This is the solution to defining a piecewise function for pgfplots. However, I would like to be able to use a macro to define each of the pieces of the function. It is simple to do this if one is ...
3
votes
1answer
243 views

! Dimension too large

I keep getting the error Dimension too large when i make my \Desktops{80} and my \DTUnits{20} however if I change my \DTUnits{14} it works, can someone help me please? ...
2
votes
2answers
4k views

Install packages in texworks missing style files

So I am trying to install the pgfplots package in LaTeX on my Windows 7 machine. I usually did this by just running the LaTeX file with \usepackage{pgfplots}, and then the computer asks me if I want ...
28
votes
3answers
1k views

Tufte like axis with pgfplots

How to achieve this kind of axis with pgfplot ? Image taken from Szymon Beczkowski's awesome PhD thesis design (thesis link) I may provide you with some data to play with. ...
54
votes
6answers
2k views

Filling specified area by random dots in TikZ

I want to reproduce the following diagram in Tikz. LaTeX code of my MWE is below: \documentclass[tikz]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \draw [-latex, ...
20
votes
2answers
4k 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 ...
28
votes
5answers
3k 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: ...
19
votes
2answers
2k 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 ...
29
votes
2answers
1k views

How to plot a lattice of points on the surface of a torus?

I am doing a report on the Ising model, without going into the complex details of the model, in its two-dimensional form it involves a lattice of points. Which, when periodic boundary conditions ...
20
votes
3answers
7k 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 ...
19
votes
3answers
3k 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 ...
17
votes
1answer
2k 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. ...
28
votes
4answers
2k views

Draw somewhat random function

I am trying to reconstruct this image here I am not very happy with the code, as it uses hacking and adding white boxes and alike. My problem is now how do I draw the somewhat arbitary function in ...
15
votes
2answers
3k 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 ...
14
votes
1answer
1k views

Tikz: intersection of line and plane

I am struggling with drawing a plane and a intersecting line. I would like to have the line C,P',P in the image, disappear if it is "behind" the plane and have it reappear if it is not behind the ...
14
votes
1answer
2k views

geographic maps with TikZ/pgfplots

I have recently discovered pgfplots and I love it. I'm converting the figures from my thesis to pgfplots, or at least the ones I have made myself. One of my figures is a map that I created using the ...
10
votes
2answers
4k views

matlab2tikz - TeX out of memory

I am using matlab2tikz to import figures from MATLAB to tex. However I quickly get the message TeX capacity exceeded, sorry [main memory size = 3000000]. I have tried expand main memory using ...
8
votes
1answer
3k views

How to plot intervals and points in the real line?

I need to plot a series of sets of intervals (and points) in the real line. Intervals can be closed, left/right-open or open. (Open/closed ends are marked with empty/filled circles) and isolated ...
6
votes
1answer
1k views

Filter rows from a table

I have a large table that contains results for many instances, and I want to make separate tables and plots grouped by one (or more) field. In this minimal working example, I want to make a table and ...
14
votes
1answer
9k views

pgfplots: Legends in multiple y-axis plot overlapping

I am trying to add a legend for two plots on two different y-axes, however they are overlapping each other and each one is being written in its own box. I would like for both of them to share a single ...
7
votes
3answers
2k views

How to coherently combine 3D and contour plots with pgfplots

Both contour and 3d plots can be done easily in pgfplots, but I have a hard time combining them nicely. Here's an example of what I'd like to achieve (from the matplotlib examples):
16
votes
1answer
1k views

Plotting Normal distribution in pgfplots

I'm trying to reproduce the following diagram in TikZ and pgfplots. My MWE with regenerated graph is below: \documentclass{standalone} \usepackage{pgfplots} \begin{document} ...
9
votes
1answer
3k views

pgfplot with constant decimal places on ticks

I'm trying to display the tick labels of the y axis of just this graph within my document formatting to two decimal places. I've tried the following code but it seems that it doesn't like the way I'm ...
5
votes
2answers
870 views

How can I plot bigger amounts of data?

I am currently playing around with hailstone sequences (collatz numbers). I would like to create a plot like this (from Wikipedia): But I don't know how this kind of plot is called (it's neither a ...
18
votes
1answer
4k views

How can I make my pgfplots ylabel multiline?

My pgfplots ylabel text is too long and looks strange. Can I make it multiline?
14
votes
1answer
2k views

How to use a string column with pgfplotstable to label datapoints in a pgfplot?

I have a comma-separated list of data points. They should be plotted as a scatter plot, and should be labeled using data from the .csv file. Having specified the first column of my file as string ...
13
votes
1answer
1k views

3D Arrow Tips for TikZ/pgfplots

I really like the arrow tips shown in How to get rid of the viewer's (incorrect) axes in an Asymptote 3D graphics and am wondering how to produce this in pgfplots: I admit I have not tried ...
13
votes
2answers
2k views

How to select a finite number of samples from the file when plotting using pgfplot

I have a datafile containing thousands of points of which I need to plot only the first 100 points. How to do this using pgfplots? I tried the following with no effect. \begin{axis}[
xlabel=k,
...
12
votes
2answers
711 views

Create x and y label which overlaps for multiple plots

I have a groupplot of 5x3. Now I want to be able to 'overlap', so to speak, the ylabel over all the plots vica versa for the xlabel. This enables me namely to make the groupplot smaller. Currently I ...
10
votes
2answers
1k views

Intersection of 2 surface plots in pgfplots

My question is pretty much a duplicate of this one. I'd like pgfplots to display the intersection between tho surface plots properly. Unfortunately, my function is quite different from the one in the ...
8
votes
2answers
1k views

pgfplots: how make axes go through origin?

For pgfplots, in all the 2D examples I've seen, and in the manual, the location of axes seems to be specified in terms of location within the plot box, i.e.,relative to top, bottom. How does one ...
15
votes
1answer
3k views

Add a legend title to the legend box with pgfplots?

I am using the awesome pgfplots package to draw some plots. I usually use \addlegendentry and get a nice default legend box. There are some options for legend box placement and layout (e.g. number of ...
13
votes
2answers
7k views

Positioning of Pgfplot axis labels

I'm trying to adjust the position of my axes labels and I'm having some trouble: \documentclass{article} \usepackage{float} \usepackage{pgfplots} \usepackage{graphicx} \begin{document} ...
12
votes
1answer
2k views

Stacked barplots/groupplots with text labels in x-coordinate

I was trying to stack a groupplot, or was it grouping a stacked plot? However I was trying to get something like: The ybar stacked option works quite nice here. But when I try to adapt it to a ...
10
votes
1answer
2k views

Having y-axis in log scale base 2 using pgfplots

I have made a chart using pgfplots as written below and I want to have the y-axis in logarithmic scale. This code works fine but the base of the logarithm is 10. How can I change it to base 2? ...
10
votes
1answer
1k views

How to Graph Floor/Ceiling Functions in LaTeX (PGFPlots)

I am trying to make a graph of some floor/ceiling functions for examplep the floor of 3x+2 like this: http://www.wolframalpha.com/input/?i=graph+of+floor%283x%2B2%29#=. However, I searched through ...
9
votes
1answer
231 views

Local colormaps in global coordinate system

I am trying to get a surface graph with two colormaps. Instead of using the full Z range i want to give the first surface its own colormap and the second surface should receive its own colormap too ...
8
votes
1answer
1k views

Pgfplots: title covers scientific notation

I have a problem with pgfplots. As you can see by compiling my MWE, the title of the plot covers the scientific notation of the y axis. Is there any way to fix that (move the title or the scientific ...
8
votes
1answer
958 views

pgfplots: color a surf using arbitrary colors

I am trying to figure out if there is an equivalent in pgfplots to what in MATLAB is done through the following command: surf(A,B). This would plot the geometry A, using the colors specified in B. I ...
8
votes
2answers
1k views

Using reference with externalized pgfplot figure

I am currently writing a document with a lot of plots. I draw them with pgfplots. which uses a lot of ressources. To manage that, I use the externalization feature of TikZ. In the file myarticle.tex, ...
7
votes
1answer
451 views

Align pinned nodes in PGFplots

I'm working with plots generated from matlab2tikz and I have several plot lines close to each other. Labeling them is proving difficult, but I believe a good looking solution could be to list the ...
7
votes
1answer
683 views

How can one predict pgfplots memory overload?

I have some legitimate data sets that overload the memory available to TeX. Of course the recommended step is to cut the number of data points instead of changing the "main memory size". (In my case ...