{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

14
votes
1answer
3k views

Remove the scientific notation which is unreasonable

From the original data, we know that they are nearly 0.087 rather that 0.087 x 10^-2. Why is there scientific notation (10^-2)? It looks ridiculous. Please help me figure it out. Thanks very much! ...
11
votes
2answers
1k views

pgfplots quadrics

I wonder whether it is possible to draw the three following quadric surfaces (cone, hyperboloids) x^2+y^2-z^2=0 x^2+y^2-z^2=1 x^2+y^2-z^2=-1 (and the axis) using pgfplots 3d or TikZ as it is ...
11
votes
1answer
3k views

Scaling colormaps with pgfplots

I have two surface plots, which I would like to have to same color for the same height. So, as the first plot is dark blue for f(x,y)=0, the right plot should also be dark blue for f(x,y)=0. However, ...
10
votes
1answer
1k views

How to have linked axes on plots?

I plot infrared spectra in many reports and I display the energy units in two ways, wavenumbers $cm^{-1}$ on the bottom x-axis and wavelength (nm) on the upper x-axis. The relationship is ...
9
votes
1answer
379 views

Sum up rows from different data files

I've a certain amount of inputfiles (.txt) for the final definition of the y-data of my axis environment. The x-data come from a different file. The goal is to sum up each row of the input files ...
9
votes
1answer
1k views

Plots with data coming from different files

Is it possible to draw a graph with pgfplots using data from different files ? Let say I have two data files : data.dat and error.dat and would like to plot column 1 versus column 0 from data.dat and ...
8
votes
1answer
1k views

Contour plot labeling applied to ordinary 2D plots

I was trying to obtain the effect that I manually created below,shown with the letter n. Now, I know that this is customary to do in contour plots, hence I've checked the manual and saw that it is ...
8
votes
3answers
2k views

Cut-off cone in TikZ

How would I draw the following cone using TikZ? I have no clue how to incorporate the "cut-off". I want to draw a picture of the cone given by the points (y, t) for y in R^d and t in (0, infty) such ...
7
votes
1answer
6k views

How to create a bar chart in which the y-axis is expressed in percents?

Suppose there is a chart like the following: This chart was created using the code: \documentclass{article} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} ...
16
votes
2answers
8k views

How can I adjust the position of xlabel and ylabel with pgfplots?

I would like to have \sin x on top of the y-axis' arrow tip and x somewhere on the right of the x-axis' arrow tip. How can I achieve that? On top of that, I would like to know how I can tweak the ...
15
votes
1answer
1k views

Modified pattern does not see the pattern color option

I have modified the north east lines pattern to accept a \LineSpace option that sets the density of the pattern (see the question Can I control the density of a pattern in TikZ?). The code works very ...
14
votes
1answer
2k views

How to scale existing coordinates data in pgfplots?

I have a plot with its data, for example \documentclass[]{article} \usepackage[]{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[] \addplot+[%multiply x data by a factor here, multiply y ...
8
votes
5answers
2k views

How can I draw dirac deltas with arrow heads with pgfplots

I would like to draw this in pgfplots: I've tried this, but I can't figure out how to get the arrowheads. \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} ...
7
votes
1answer
1k views

pgfplots: color a (3D) surf using arbitrary RGB colors

I would like to color a surf using arbitrary RGB colors (unlike this question, which just colors the surf using the colormap). In this minimal example (which plots the x+y function), I would like the ...
4
votes
2answers
1k views

Enlarge limits by absolute value when using symbolic coordinates

How can I expand the x-axis by, say 1cm, in both directions in the following bar plot? \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ybar,symbolic x ...
3
votes
1answer
1k views

Bar chart - Single colored bar

For the bar chart proposed, I would like to use different color for each single bar. How can I do this? \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} ...
14
votes
2answers
760 views

Naming the nodes of `nodes near coords` for later use

I would like to use pgfplots command nodes near coords to get a list of named node ((no1), (no2), (no3) etc.) that I can use afterwards to draw some paths that I fail to construct with pgfplots only. ...
11
votes
3answers
464 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
1answer
1k views

Extract the x/y part from a coordinate in pgfplots

How can I extract only the x or y part of a predefined coordinate? For instance, let's say we have \coordinate (A) at (1,2); And I want to use the x part of (A) like this \draw (x of A,3)--(0,0);
9
votes
2answers
624 views

pgfplots function x^(0.5) skipping first sample, sqrt is not

In the following example, you will see that the sample at (0,0) is not drawn using x^(0.5) (blue), with sqrt it is (green). How can you explain that? \documentclass{standalone} \usepackage{pgfplots} ...
9
votes
1answer
2k views

Using ifthenelse in pgfmath

Following questions on constructing functions on the forum, I tried to build some myself. I can't seem to get the ifthenelse function in TikZ/PGF to work. Here is an example: ...
8
votes
2answers
535 views

half of a hyperbola

Only top portion of half my hyperbola is coming in correctly. The other half is doing something strange: \documentclass{article} \usepackage{tikz, pgf} \begin{document} \begin{center} ...
7
votes
2answers
4k views

How to save a figure produced by tikz save/export as JPG/PNG file

I have created various plots using pgfplots package for my thesis. Now I would export them in jpg or png format. Does it exist a way to achieve this porpouse?
5
votes
1answer
945 views

pgfplots import data from table with comma as decimal separator

I am trying to plot data from data files which are using the comma as decimal separator instead of a point (as is normal in SI style (French version): ...
5
votes
1answer
1k views

Is there any way to remove mesh lines completely in a pgfplots faceted 3d plot?

I can not seem to find the way to remove the lines in the surface mesh in a 3d faceted plot. I need a solution that does not use the "shader=interp" (i.e. gradient filling) so that the faces are ...
3
votes
1answer
634 views

font size scaling and node placement issues using pgfplots and tikzscale

From the tikzscale documentation I understand, that it is supposed to keep font sizes constant. However, this does not seem to apply to axis ticks or axis labels from pgfplots' axis environment. Also, ...
3
votes
1answer
659 views

Settting PGFplots axis environment options by means of \newcommand and {\newlength,\setlength}

Because I often use the same options for multiple axes in my LaTeX documents, I use the following code to simplify my life. \documentclass{article} \usepackage{pgfplots} ...
3
votes
1answer
2k 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 ...
10
votes
2answers
305 views

Gap between line and point in pgfplots, like pointintervalbox in gnuplot

I wondered if it is possible to create a scatter plot in pgfplots with a similar style as the "pointintervalbox" option in gnuplot, i.e. a plot with points and lines, but there is a gap between the ...
8
votes
1answer
518 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
514 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 ...
6
votes
2answers
2k views

Force “axis on top” for plotmarks in pgfplots

The pgfplots manual says that axis on top=true won't affect the plot if using plotmarks as this usually doesn't make sense, which I agree with. However, in this case I'd prefer both the axis and tick ...
5
votes
2answers
453 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
256 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 ...
4
votes
1answer
184 views

Problem using atan in pgfplots

I'm trying to plot something using atan in pgfplots, but it always results in hundreds of errors. I'm using an example I found here: \documentclass{article} \usepackage{pgfplots} \begin{document} ...
4
votes
1answer
674 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
404 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
118 views

Pgfplots rounded corners and plot problem

I noticed something strange recently when trying to use rounded corners in pgfplots: it totally ruins the plot. See below without rounded corners: and then with rounded corners: Here is a ...
3
votes
1answer
313 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
1answer
239 views

Creating performance profiles

A performance profile is a kind of plot used in the optimization community; here below is an example from http://www.gamsworld.com/performance. For an introduction, see Section 22.4 of Higham and ...
2
votes
2answers
6k 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 ...
24
votes
3answers
9k 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
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. ...
17
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 ...
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 ...