{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

38
votes
3answers
10k 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 ...
11
votes
1answer
2k views

pgfplots and calculations; without fpu 'dimension too large', with fpu 'Illegal unit of measure (pt inserted)'

I'm trying to multiply some numbers that will end up in the legend of a plot. I can't get it to work: If I naively try \pgfmathmultiply, I get a dimension too large error, with the code in MWE 1 ...
5
votes
3answers
4k views

Axis limits in user-defined style

(related but unequal question: Using Macro Defined Lists in TikZ/PGFplots) I'm having several axis-environments inside the same tikzpicture. I would like to have some (but not all) share the same ...
7
votes
3answers
356 views

Which plotting tool is more likely to stay stable in the basics: MetaPost, PStricks or pgfplots?

I have been looking at the three (major ?) tools---MetaPost, PStricks or pgfplots for plotting data together with LaTeX. My experience is this: MetaPost code can demand lots of lines for simple ...
7
votes
1answer
2k views

Center nodes near coords in a stacked ybar plot

I'm trying to center the node values, at the middle of each bar, in a stacked plot. However I can only put those nodes in the top of each bar. Is it possible to move those down? To the center of each ...
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 ...
7
votes
1answer
753 views

pgfplots ticks are not applied

I am trying to create a 3D plot with custom z-ticks. However I can not create them with starting negative number. It works however as expected when the ticks start at 0. My code is this one ...
1
vote
1answer
338 views

Use pgfplots and a custom length to define global width when inputing the plot

I'm trying to set the width for all my plots, that are defined in other files and imported into the main document, using a custom width, \sz. I'm trying to set this length because I want to change it ...
3
votes
1answer
3k views

PGFPLOTS: figure and table formatting

Just after an hour spending browsing through the pgfplots manual, I am trying to have a figure and a table side by side (both the figure and the table use the same data). So I still have lot to learn! ...
9
votes
1answer
3k views

pgfplot: accuracy of tick labels

the y-axis of my diagram uses small numbers like 0,005. I don't want to use a multiplier like 10^-3 which appears by default. If I remove it with scaled x ticks = false, x tick label ...
5
votes
1answer
858 views

Linebreak in ticks-labels

I'm using \symbolic y coords in a xbar-plot. Some of these coords are very long. There is a solution using nodes which is very ... hardcoded. And it would be nice to have it automated. How do I ...
8
votes
1answer
2k views

pgfplots from file: search path, looking for \graphicspath equivalent

I have recently discovered the wonderful pgfplots package and I've started coding my Python code to output tabular data of whatever is plotted (at least for simple plots). In my LaTeX source code, I ...
3
votes
1answer
2k views

PGFPlots: Axis dashed

How to configure axis dashed on PGFPlots? \begin{axis}[grid=major] %need grid=dashed \end{axis}
4
votes
2answers
3k views

Bar plot labels and grids

\documentclass[a4paper,11pt]{report} \usepackage{tikz} \usepackage{verbatim} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ title = {Optimalization based upon co-occurences}, ...
6
votes
2answers
4k views

Proper way to change axis in plot tikz

I am trying to reconstruct the image below in tikz, and I think I have done a fairly decent job. The problem is that my code is a mess. Is there any simple clean way to produce this image? My ...
9
votes
2answers
3k views

Remove rows in a \addplot table command

Is there any way to adapt Show last N rows from input datafile only in \pgfplotstabletypeset to a \addplot table command ? This doesn't work: \documentclass{article} \usepackage{pgfplots} ...
10
votes
1answer
3k views

Axis with trigonometric labels in PGFPlots

How do I make the axis labels use multiples of \pi in PGFPlots?
9
votes
2answers
958 views

pgfplots: two labelings for a single 3d plot

I am trying to add a second labeling to my 3d plot, but I can not figure out how to do it correctly. The idea is to add a second axis without any grid, ticks, lines and nothing but labels and overlay ...
4
votes
2answers
2k views

Set a colormap to fill a bar plot using pgfplots

I'm trying to change the default color of the bar plot with a a colormap without success. The thing is that I don't like the default color sequence. However, I was wondering if there is a way of ...
3
votes
1answer
730 views

Debugging Advice: TeX Capacity Exceeded with TeXLive2011 (but not with TeXLive2010)

I have a feeling that this is going to be rather embarrassing when I eventually get to the bottom of this problem, but since I have been struggling with this for some time I am posting this question ...
16
votes
1answer
1k views

Surface of Revolution

how to draw using surface of revolution tikz or pgfplots? \documentclass{article} \usepackage{tikz,pgfplots} \begin{document} \begin{tikzpicture} \end{tikzpicture} \end{document} I am not able to ...
8
votes
1answer
3k views

Spacing in pgfplots bar plot

I've been trying to plot an xbar graph using pgfplots within a tikzpicture. I want to be able to only show the yaxis on the left and the x axis on the bottom. When I set axis y line=left and axis x ...
22
votes
3answers
4k views

filling area between 2 functions, with shading

I would like to plot two (rather simple) functions f, g over domain -2:2 and fill the area between them. The fill color should be red if f > g and green if f < g (for example), and in later ...
12
votes
1answer
1k views

Quiver scale in pgfplots (unit scaling)

Quiver plots can be made within pgfplots. Here is a minimal example which is a vector field of [1, x-y]: \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} \begin{document} ...
19
votes
2answers
1k views

Highlighting Extremal Values in Table

In a table generated by pgfplotstable, how can I highlight for each column or row the cell with the minimum value (e. g. displaying the corresponding entry in bold face)? Example:
7
votes
2answers
3k views

domain option for pgfplot's \addplot ignored?

I want to do a simple plot of goniometric functions with pgf in a beamer presentation: \usepackage{tikz,pgfplots} % ... \begin{tikzpicture} \begin{axis}\addplot[domain=0:pi]{sin(deg(x))}; ...
1
vote
1answer
1k views

Some simple surface drawing using addplot3 for pgfplots won't compile

I am having trouble compiling even some very simple surface drawing using pgfplot and addplot3, for example please see the attached code, I keep getting error saying \begin{axis} on input line 8 ended ...
6
votes
1answer
2k views

error bar colors in scatter plot

A data file contains four columns: x, y, error on y, class. class is an integer which I feed to scatter src so i get a graph that has different colors for different classes. However, the error bars ...
6
votes
1answer
3k views

Pgfplots: put plot legend on the outside margin?

I use classsicthesis style for my PhD. Since this style is somehow geared towards using the outside margin for additional notes and stuff, I thought I could also place the legends of my plots there. I ...
11
votes
1answer
1k 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 ...
2
votes
1answer
623 views

Legend with Markers for Mesh Plot

I use a mesh plot with scatter points (2d) where the colors are determined from a third coordinate of the data as described in this question. The legend however should contain the markers of a curve ...
2
votes
1answer
395 views

Styled or fixed color line-segments in PGF

When I want to plot coordinate data, I know that I can color individual scatter points using defined colors using point meta=explicit. The line segments between two points seem to be colored by an ...
17
votes
1answer
4k 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 ...
6
votes
1answer
845 views

dropping ticklabel on pgfplot axis

I've just started to play with pgfplot. I'm trying to prepare a plot like to following \begin{figure}[h] \centering \begin{tikzpicture} \begin{axis}[minor tick num=1, axis x line=middle, axis y ...
2
votes
1answer
680 views

Consistently specify function to be graphed with or without gnuplot

I would like to be able to specify a function and then graph that with with pgfplot only, or use gnuplot to compute the coordinates. As far as I know there are two main differences in how the ...
6
votes
1answer
839 views

Consistent Pgfplot Labels Positions with/without Gnuplot

I like that I can place a node at the end of plot and the node appears relative to the last point on the graph. When the domain is specified in increasing order \DomainMin:\DomainMax, the label gets ...
4
votes
1answer
629 views

pgfplots: “nodes near coords” on xbar chart is off

I am trying to make an xbar chart using pgfplots, and I'd like to add the bar's value to the bar. Simply using "nodes near coords" positions the value for a ybar chart, which isn't correct here. ...
11
votes
1answer
1k views

pgfplots: auto-size chart?

I have an xbar graph with some some data that I don't necessarily know the length of beforehand. Is there some way I can tell pgfplots to automatically expand the height of the chart according to the ...
9
votes
1answer
526 views

Using pgfplots with a0poster

I want to use tikz/pgf to plot some graphs in a poster done with a0poster. That is the code: \begin{tikzpicture} \begin{axis}[xlabel=lambda, ylabel=int] \addplot[blue] table [mark=none, col ...
10
votes
1answer
1k views

How to generate templates for charts

Most of us create charts that have to be repeated a number of times with only the data varying. Applying DRY (do not repeat yourself) programming principles to such problems is not an easy task. To ...
16
votes
2answers
1k 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 ...
10
votes
2answers
4k views

How to stack and align multiple plots with same x but different y axes?

I have several series of datapoints from each of several sites. I would like to produce a series of stacked plots, close together as in the attached example, to allow comparison both within and ...
5
votes
1answer
5k views

How to configure axis on pgfplots?

How to configure axis on pgfplots? Similar for this. \documentclass{article} \usepackage{tikz,pgfplots} \pagestyle{empty} \begin{document} \begin{tikzpicture}[>=latex] %x axis \draw[->] (-5,0) ...
28
votes
2answers
9k 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" ...
4
votes
2answers
1k views

Line break in datapoint label with pgfplot?

I have a bar chart, with labels for each column. I would like to break these labels over two lines. I'm not using nodes so the "align" trick doesn't seem to apply. Minimal example: (from Lyx) ...
7
votes
2answers
626 views

How to maintain the ratio between two axis in pgfplots

I have two axis environments both containing different plots. I do however want to maintain comparability between both, i.e. I want both plots to consume the same space on the paper for a coordinate ...
6
votes
1answer
2k views

How to use sin function in pgfplots?

How to use sin function in pgfplots? In this post Timing and integration with TikZ PGFlots i need [/pgf/declare function={f=sin(x);}] but generate a line, and [/pgf/declare function={f=sin(x r);}] not ...
9
votes
2answers
1k views

Timing and integration with TikZ PGFlots

How do I set intervals or integration with TikZ PGFlots? Something similar to the figure below, but I want to define the function, the intervals of integration and the partitions. ...
6
votes
1answer
2k views

Multi-line nodes/annotations in pgfplot

It would be great if I could get the annotation in the graph depicted below on two lines, but I can't seem to figure it out. Presently, I have: \begin{tikzpicture} \begin{axis}[ ...
3
votes
0answers
1k views

How can I export pdf files with tikz/pgfplots? [closed]

I am writing a long thesis and would like to source out some graphics, so that I do not have to in every run I am compiling the tex file. Here is a simple example: \documentclass[a4paper]{scrreprt} ...