{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

13
votes
1answer
1k views

TikZ, 3d library and circle fading

I'm using the 3d library to put a circle on the z=0 plane, and other things. I'd like to fade this circle radially, but the result isn't as I would expect because the fading is not proportional to the ...
13
votes
2answers
891 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 ...
13
votes
1answer
1k 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 ...
13
votes
2answers
540 views

tikz pgfplots ternary diagram, density map

I am plotting points in a ternary diagram using pgfplots and the ternary axis environment. Each point does posses a 4th value (besides the 3 that are the coordinates). At the moment I am stating ...
13
votes
1answer
703 views

Using pgfplots, how can I make and use a colormap that has a sharp transition in the middle?

I wish to make a colormap where the distinction between numbers smaller than 0 and numbers greater than 0 is emphasised. So I want to make a colormap that has one sharp transition in the middle and ...
13
votes
2answers
878 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 ...
13
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 ...
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 ...
13
votes
1answer
842 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 ...
13
votes
1answer
2k 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 ...
13
votes
1answer
2k views

Plotting an implicit function using pgfplots

What is the correct way to plot an implicit function using pgfplots? Consider the following example: \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} ...
13
votes
1answer
2k 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 ...
12
votes
3answers
547 views

Draw a cylindrical spiral with TikZ

I want to make a tikzpicture to illustrate the construction of a spiral capacitor. These are made of spiral coiled films. So imagine a rectangular paper that you tail around one side. Thats basically ...
12
votes
2answers
1k views

Stacked bar plots with several descriptive nodes

I have a stacked bar plot where I would like to display additional information for each bar—besides their cumulative values. This information should include the non-cumulative values and the ...
12
votes
5answers
667 views

Create image from statistical data automatically

I am looking for a way to automatically create images like the one below: There is no MWE because all I have, for now, is this image (created, I believe, by SPSS, but I have nothing to do with that ...
12
votes
2answers
422 views

Can PGF plot the integral of any specified function?

How can I use the pgf maths engine to plot the integral of any function? For example \addplot {int(cos(x))} does not work.
12
votes
1answer
6k 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 ...
12
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
3k views

Drawing curves and multiple y-axes in one plot with pgfplots

I'm aware of the possibility given by pgfplots to have two y-axes, one on the left and one on the right with two different scales. But I'd like to explore other ways to have multiple axes, e.g. ...
12
votes
2answers
5k views

Removing x and y ticks in PGFplot

I'm trying to disable the ticks from showing on this diagram: I've tried using x tick=empty as you can see, but it doesn't appear to change anything since I'm not actually plotting in the axis, only ...
12
votes
1answer
3k views

Removing legend box (border) in pgfplots

I'm attempting to remove or 'turn off' the legend border in pgfplots, but I can't seem to figure out how to do it. I assume it will look something like this: \begin{axis}[ legend style={?}] where ...
12
votes
2answers
298 views

TikZ: Regression Line with Residuals

Desired Output I made this diagram in R with ggplot2. Now I want to reproduce this diagram with Tikz. My MWE is: \documentclass[tikz]{standalone} \usepackage{pgfplots} \usepackage{pgfplotstable} ...
12
votes
1answer
2k 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 ...
12
votes
1answer
538 views

pgfplots: dimension too large when reading data from file

Based on the following data table data.dat x a b c d 0 284.15 69.18 284.15 70.26 0.03 284.15 70.20 284.15 70.04 0.04 318.15 70.20 284.15 ...
12
votes
1answer
3k views

How do I make a TikZ/pgfplots scatter plot without lines between points

I am attempting to make a scatter plot from a table of data. I seem to have almost succeeded, but there are lines between the points. I do not want this to happen, but I can't figure out how to remove ...
12
votes
1answer
851 views

Plot x y data from different files/tables

I have two data files (xxxx.txt and yyyy.txt), each only containing one column of x and y data respectively. Now I want to plot these two data together in a simple 2D diagram. Has anybody an idea how ...
12
votes
1answer
380 views

PGFPlots % in ticks labels

Hi i want to put this simbol "%" in the tick labels only in the x axis how can i do?
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 ...
12
votes
1answer
9k views

How to properly scale a TikZ/PGF picture which has a `\begin{axis}…\end{axis}`

Applying a scale option to a TikZ picture works great. It keeps the text the proper size and scales everything else. I would like to have the same behavior when using a \begin{axis}...\end{axis}. ...
12
votes
2answers
338 views

How can I do an affine coordinate transformation in pgfplots?

It is possible to perform a general affine coordinate transformation in TikZ by combining the shift, x, and y keys (or just the generalized cm key to set the coordinate matrix and shift). This allows ...
12
votes
1answer
881 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 ...
12
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
273 views

Having tick labels like 1, 10, 10^2, 10^3,

I would like to have y tick labels like 1, 10, 10^2, 10^3, ... So far I found found to display them either 1, 10, 100, 1000, ... or with exponents. Is this possible with pgfplots?
11
votes
3answers
269 views

PGFPlots: How to draw a label at a zero of a function?

Is there an easy method to construct a node (and hence a label) at a zero of a function, i.e. at the intersection of the function with the x-axis? The examples I found were somehow too complicated, ...
11
votes
2answers
2k 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 ...
11
votes
2answers
1k 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}
11
votes
2answers
2k 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 ...
11
votes
2answers
1k views

How to plot three-dimensional polar functions with pgfplots

I would like to plot the following functions with pgfplots: I know how they are defined: \sqrt{r}\sin\frac{\theta}{2}, \sqrt{r}\sin\frac{\theta}{2}\sin\theta, \sqrt{r}\cos\frac{\theta}{2}, ...
11
votes
3answers
571 views

pgfplots - Add offset to pins

I'm trying to make a bar plot for an optimization parameter in quantum physics. To be more informative, the graph should display the values of these parameters above the bars. So far I did ...
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
3answers
4k views

Using LaTeX to draw time series graphs and histograms

I have some graphs I drew in maple, some simple line plots and histograms. Now I'd like to redraw these graphs in LaTeX, so I can do fancy stuff in beamer like have one histogram appear, and then ...
11
votes
1answer
3k views

What does “running in backwards compatibility mode” mean and what should I fix to get rid of it?

I was typesetting a Tex file, but I got this warning: ! Package pgfplots Warning: running in backwards compatibility mode (unsuitable tick labels; missing features). Consider writing ...
11
votes
2answers
3k views

Increasing TeX's main memory

I have a plot with a lot of measurement datapoints. I exported this plot from Matlab2tikz. When I wanted to compile this, it said that the memory was exceeded. Now I found this, How to expand TeX's ...
11
votes
1answer
3k views

Change the appearance of grids in pgfplots

I am asking if there is a command in the pgfplots package that changes the appearance of the grid in terms of kind of the lines. What I mean is how to change the kind of lines. I have read the ...
11
votes
3answers
2k views

\pgfmathsetmacro - dimension too large (biggest value allowed?)

I want to import some data with parameters to parametrize some plots. After importing a table, I assign specific variables of the table to a placeholder by using \pgfplotstablegetelem. And it works ...
11
votes
1answer
2k views

Adding values to pgfplot legend

As a follow-up to my earlier question (here), here is a question that is perhaps a little more latex than gnuplot. having used gnuplot and pgfplots to generate a fitted curve, is there an easy way to ...
11
votes
1answer
3k views

Default color pgfplot

I noticed that when using pgfplots to make plots without specifying style, it automatically assigns the same color and line style to the first input and fifth input, which means the two curves would ...
11
votes
2answers
9k views

Basic bar chart with text as x axis labels

I am trying to create a very basic bar chart using pgfplots. I need four bars representing percentages with text as labels under the x axis. Text labels contain spaces and accented, non-English ...
11
votes
2answers
172 views

Can I rotate a marker with a scatter source?

I'd like to be able to use pgfplots to show a skier going down a ski slope. Here is what I have done so far. \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.7} \makeatletter ...
11
votes
1answer
2k views

Custom Dashed Plot Lines in PGFPLots

I know that you can make a dashed line in pgfplots using the \addplot[dashed] option. However, the line that produces isn't dashed the way I'd like. I found \pgfsetdash in the documentation for ...