{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

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 ...
30
votes
2answers
2k 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 ...
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. ...
15
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
3k 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 ...
12
votes
2answers
5k 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 ...
11
votes
1answer
2k views

Using Labels from a File in PGFplot

I am using LaTeX, TikZ and PGFplot in order to automatically generate several series of diagrams, one of which is comprised of bar charts. Each bar in each bar chart may have a unique label and height ...
7
votes
1answer
2k 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 ...
8
votes
3answers
3k 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):
20
votes
3answers
434 views

Plotting a graph with several values of a parameter

I'm trying to plot the function q(t) = (4.9/ (w^2))*(cosh(w*t)-cos(w*t)) for several values of the parameter w. That is, I want to plot whole graphs of q vs t, where I plug in say w=1, w=2, w=100, or ...
13
votes
2answers
4k 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
4k views

How can a title be placed for a group of pgfplots?

Using the groupplots library in pgfplots, how can a title be set for a group of plots? The following code (basically from the manual) is an example layout. I don't want each plot to have a title, ...
9
votes
3answers
5k views

Easiest way to plot matrix image

Is there an easier way to create this in pgfplots than plotting the matrix image externally and using addplot graphics (as on p.42 of the pgfplots manual)? A mesh plot (as suggested for plotting ...
5
votes
2answers
1k 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 ...
22
votes
1answer
5k views

How can I make my pgfplots ylabel multiline?

My pgfplots ylabel text is too long and looks strange. Can I make it multiline?
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 ...
14
votes
1answer
3k 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 ...
10
votes
2answers
2k 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 ...
9
votes
1answer
938 views

pgfplots - Provide a detailed plot inside the main plot

I have a main plot and inside it I would like to add a smaller plot that offers a higher level of detail. A rough illustration of the above is: Notice that the smaller plot provides a more ...
9
votes
1answer
1k 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 ...
7
votes
3answers
1k views

pgfplots: 3D surface plot from data with free format

I want to plot 3D data from a file (data file) using pgfplots. The data represents an ellipsoid. I want to draw the outer shell like in the following picture, just without the background and in ...
7
votes
1answer
4k views

Vertical line in ymode=log plot

Please have a look at the following MWE: \documentclass{article} \usepackage{pgfplots,pgfplotstable} \begin{document} \begin{tikzpicture} \begin{axis}[ %ymode=log, ] ...
17
votes
2answers
507 views

How to make a longitudinal sine wave shading with pgfplots?

At the moment I use TikZ shadings to show up longitudinal waves in my document like this: The shading is white where the sine is –1 and blue where the sine equals 1. This looks ok, but ...
16
votes
6answers
740 views

Draw a smooth surface

I would like to draw a smooth surface like http://mathematica.stackexchange.com/questions/20912/how-to-draw-a-higher-genus-surface but using Asymptote, TikZ, Metapost, PStricks, or other TeX friendly ...
16
votes
2answers
14k 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} ...
16
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 ...
14
votes
1answer
2k 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 ...
13
votes
2answers
3k views

Big data surface plots: Call gnuplot from tikz to generate bitmap and include automatically?

Motivation I have large numerical data files, that I would like to create density (surface) plots of. Since they are very big, we can rule out a few possibilities such as to plot them directly with ...
12
votes
2answers
3k views

Is it possible to multiply the x coordinates of a plot by a certain factor using pgfplots

I have a pgf plot. Now the scale on the x-axis is at the moment frequency, hz, but it should be rad/s to save myself time exporting the file again is it possible to multiply the x-coordinate of every ...
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 ...
11
votes
1answer
3k 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? ...
9
votes
1answer
381 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 ...
9
votes
1answer
7k views

individual tick label style with pgfplots

given the following code, I want to modify the tick labels in such a way, that for negative values of x, the labels are located above the x-axis. How can I realize this? \documentclass{report} ...
8
votes
1answer
546 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 ...
8
votes
3answers
3k views

pgfplots with symbolic x coords and error bars

I am trying to plot explicit error bars like this: \begin{tikzpicture} \begin{axis} [symbolic x coords={Lighting,Computers,Total}] \addplot+[only marks] plot[error bars/.cd, y dir=both, y explicit] ...
8
votes
1answer
2k 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
2answers
2k 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
3answers
3k 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} ...
7
votes
2answers
2k views

Draw sphere pgfplots with axis at center

I want to draw a plot that illustrates the ration pattern of an isotropic antenna. I thought about pgfplots to do the job. I grabbed the code from pgfplots manual and did some changes; but it doesn't ...
7
votes
1answer
756 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 ...
6
votes
2answers
684 views

pgfplots - highlighting/filling an area in a data file

How does one highlight a specific domain range of a datafile in pgfplots? For example I'd like do do something like: \begin{tikzpicture}[baseline,trim axis left] \begin{axis}[ ylabel=frequency, y ...
6
votes
1answer
803 views

2d graphs in a 3d plot

I am trying to create 3d plots with several 2d graphs, like in Plotting several 2d functions in a 3d graph. However the end result looks like this: Using \closedcycle doesn't help either, as it ...
6
votes
1answer
2k 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 ...
5
votes
1answer
396 views

Is there a way to draw a Voronoi diagram with pgfplots?

I want to draw a voronoi diagram with pgfplots, but sadly I cannot get it the way it should look like. I used the Matlab command to get the x and y coordinates and saved them as a dat-file. In that ...
4
votes
1answer
172 views

PGFplots and table with different number of elements in columns

I am trying to plot a table where I have different number of elements in the columns. In the MWE, the pairs (x1,y1),...,(x4,y4) all have different number of elements, can I use PGFplots in such ...
4
votes
2answers
2k views

How to make pgfplots vertical labels have proper hyperref erence box?

PGFPlots and hyperref don't seem to play well together for vertical text. For example, the ylabel (which is vertical) shows its hyperref box in the middle of nowhere instead of at the position and ...
14
votes
2answers
1k views

Allow underscore in PGFPlots tick labels read from table

I'm trying to use the text data from a table column as the tick labels in a plot. The text data contains underscores, which makes LaTeX throw a Missing $ inserted error. I'd usually get around this by ...
14
votes
2answers
6k views

ylabel postion with pgfplots

I am using pgfplots to plot some data, but I am having problem you see in the image below. Basically, the ylabel overlaps with the axis numbering. I have googled a LOT but couldn't find any solution. ...
13
votes
1answer
21k views

Customize legend position in PGFplots axis environment

I am trying to customize the position of the legend in the axis environment of PGFplots. A simple way to do this is by using something like legend pos=south west|south east|north west|north east ...