{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

6
votes
2answers
551 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
575 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 ...
4
votes
1answer
132 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 ...
16
votes
2answers
309 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 ...
14
votes
1answer
1k 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 ...
13
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 ...
13
votes
2answers
5k 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. ...
12
votes
1answer
806 views

How can I automatically mark local extrema with pgfplots and scatter?

I am trying to have TikZ automatically mark a local maximum in a fourth-degree polynomial I built using a curve-fitting tool. I am new to LaTeX and TikZ, and am a bit overwhelmed - there seem to be a ...
11
votes
1answer
774 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 ...
11
votes
2answers
452 views

Visualize data on a variable-radius graph/network

I am trying to visualize the output from a simulation model I have been working with. The simulation finds the steady-state solution to a system of differential equations on a variable-radius (and ...
10
votes
1answer
508 views

Is there a workaround against loss of precision in pgfplots axis?

I am generating a bunch of plots automatically using pgfplots. For some datasets the span of data in one axis (y) is relatively small (relative to the absolute value) and therefore pgfplots when ...
10
votes
1answer
2k views

pgfplot pin length

Consider the following example from the pgfplot manual. \begin{tikzpicture} \tikzset{ every pin/.style={fill=yellow!50!white,rectangle,rounded corners=3pt,font=\tiny}, small ...
10
votes
1answer
3k views

What “smooth” plot interpolation algorithm does pgfplots use?

In the pgfplots manual it says: \addplot+[smooth] Smooth plots interpolate smoothly between successive points. In order to choose the right sampling of points from a function evaluation for ...
9
votes
1answer
332 views

externalize pgfplots, and only pgfplots

I would like to externalize the plots in my document (using pgplots), but not other inline stuff, such as bonds automatically drawn by chemmacros. That is, in the following test document: ...
8
votes
1answer
586 views

How to reuse the plotmark styles from PGFPlots outside the tikzpicture environment?

In a figure caption or in the main text I want to reuse the style of the plotmarks or the combination of line and symbol as in the figure legend. As I did not find a command to reuse the legend image ...
8
votes
2answers
3k views

pgfplots ticklabel format logarithmic scale

How do I disable exponent notation on logarithmic scale? I want ...,$10^0$,$10^1$,$10^2$,... replaced by ...,1,10,100,... I have tried to play with this default(pgfplots manual p. 209): ...
7
votes
1answer
489 views

Read boxplot prepared values from a table

Update: Is there any possibility of drawing two box plots this way using a single datatable as in the updated MWE below? I'm trying to use pgfplots 1.8's shiny new boxplot feature. As I am also ...
7
votes
2answers
792 views

Particular bar plot with pgfplots: bar color = category

I want to create a bar plot using pgfplots. In this plot the bars should be represent categorys. So that one color suggest the category. The categorys are: 0-8 None 9-13 Minimal 14-19 Slightly ...
7
votes
3answers
2k 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] ...
7
votes
1answer
823 views

Calculate and draw difference of two plots automatically

I'm trying to automatically generate a plot, which visualizes the difference of two other plots. The input source is a single(!) file. The data is filtered by one column with /tr/rowfilter. Here is an ...
6
votes
1answer
965 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 ...
6
votes
2answers
524 views

Wrong pgfplots plot for function with vertical asymptote

I want to plot the function $\frac{3 x}{1 + x}$ with pgfplots. Using \begin{tikzpicture} \begin{axis}[axis x line=none, axis y line=none, no markers] \addplot {3 * x / (1 + x)}; ...
6
votes
1answer
444 views

Question regarding piecewise syntax with pgfplot?

The piece function is defined as following: Here is the code snippet: \pgfmathdeclarefunction{func}{1}{% \pgfmathparse{% (and(#1>=0 , #1<=500) * (300 + #1*(12/10)) +% ...
6
votes
1answer
1k 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 ...
3
votes
1answer
444 views

pgfplots: how to load distinct symbolic ticks/labels from file?

I want to plot a matrix of color-values from a csv file. Inspired by this website, I set out to write my MWE below, to which I added this way of dynamically loading symbolic ticks/labels from my data ...
2
votes
1answer
700 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 ...
1
vote
1answer
187 views

Tikz won't plot the function properly

I tried to plot the following function but it didn't work: y = 300 + 1000/x + 2.5x. This is the document, but instead of the plot it only shows the axis. \documentclass{article} ...
16
votes
1answer
2k views

PGFplot Axis Labels Detaching From Graph

Update: Aug 04, 2013 With the current version of TeXLive 2013, the second MWE below still exhibits the same behavior if the \todo[inline] is commented out after the first run. Furthermore, the ...
15
votes
1answer
16k views

How can I change the legend's location in a pgfplot?

For a report I am preparing several figures that I exported from Matlab using the matlab2tikz script. However, the location of the legend does not please me. Here is an example plot: I want to move ...
14
votes
1answer
1k views

Dos and Don'ts of \pgfplotsset{compat=newest}

Question I just upgraded to 1.9. Christian recommends against the \pgfplotsset{compat=newest}, but that leaves one having to come back and update compat=x.y in one's projects, several times, over a ...
14
votes
2answers
667 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. ...
13
votes
1answer
2k 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
1answer
909 views

How can I draw a quiver plot with varying line thickness?

This question originates in Scalar field in pgfplots . How can I draw a quiver plot in which the arrows have the same length, but their line width varies according to some scalar property of the ...
12
votes
3answers
2k views

PGFPlot - Missing values in table data

I am using PGFPlot with external table data. However, some values are missing for some plots. This causes data in column 2 does not exists error. Is there a way to solve this. The value does not ...
11
votes
1answer
2k views

pgfplots - Placing Nodes on x Coordinates of a Plot

I want to plot some graphs in pgfplots and want to place nodes on the exact same x coordinate of the plot. The position of the note has to be set in x direction but free in y direction. Here is one ...
11
votes
1answer
589 views

Why does pgfplots package cause tikz layer to disappear?

I wish to include a pgf-generated line plot and a tikz-generated graphical model in the same document. However, the presence of the pgfplots package (needed for the axis environment) seems to turn one ...
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 ...
10
votes
2answers
1k views

“pgf Error: No shape named i-0 is known”, but only upon 2nd run

Update 2012-01-31: This seems to be a version (and/or OS specific) problem. It breaks on my latest TeXLive2011 on a Mac, but I can get it to run on my PC version of MiKTeX 2.8, and @MarcvanDongen ...
9
votes
2answers
285 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
2answers
298 views

Adding to a \foreach variable in pgfplots

How can I say sum multiple columns of a table using y expr while also using \foreach I was hoping something like this would work but apparently it requires some sort of expression evaluation I can't ...
9
votes
1answer
747 views

How can I add space between two separate plots, using pgfplots?

I currently have the following: Now as you can probably imagine I do not want this. I want the upper right plot to be aligned with the lower right plot. However when I do this, using the at and ...
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} ...
8
votes
1answer
12k 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 ...
8
votes
2answers
849 views

Helix on a cylinder

I want to plot geodesics on a cylinder. These are straight lines, circles or helices. I can plot the first two, but I don't know how to draw the helices. To be precise, I would like to know how to ...
8
votes
1answer
635 views

Polar Plot x and y ticks and units

I'm having some trouble with polar plots. I generate the plot coordinates using Scilab and then plot them in Latex. I can't figure out how to remove the points (mark = \empty does nothing, but ...
8
votes
1answer
2k views

Different color for individual bar in bar chart & adding bar labels

Please consider the following MWE. There are three things I would like to do: Individual colouring For the last element ("not rejected") I would like to fill the bar with another color (e.g. ...
8
votes
2answers
1k views

pgfplots: post-processing data created with gnuplot

I have managed to use pgfplots' gnuplot option to solve an implicit equation: \documentclass{standalone} \usepackage{tikz,pgfplots} \begin{document} \begin{tikzpicture} \begin{loglogaxis}[ ...
8
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: ...
7
votes
1answer
718 views

weibull plot with arbitrary y axis scale

I want to draw a function in a weibull plot. The x axis is log, the y axis however goes with log(-log(1-y)) (as far as I understood it from this site). The y axis looks similar to a log scale but ...
7
votes
1answer
1k views

import input pgfplots with relative paths

The package import makes it posible to \input (and \include) a .tex document which itself \input (or \includegraphics etc.) stuff using relative paths. I was hoping that this also would work with the ...