{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

12
votes
1answer
686 views

Brownian motion with drift

I have a code for the Brownian motion and it indicates three paths which initially started at point 0. My goal is to increase the initial starting point from 0.0 to e.g. 0.6. This is achieved by ...
12
votes
2answers
480 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
600 views

Building a 2D histogram with PGFPlots

What I want to achieve The framework ROOT can create 2D histogram plots with colored boxes indicating count rate that looks something like: My question is really only: can I produce this kind of ...
12
votes
1answer
382 views

Drawing a semicircle in 3D with pgfplots

I'm trying to make a plot of a torus with a semicircle drawn on its surface. The following MWE \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} ...
12
votes
1answer
631 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 ...
12
votes
1answer
3k views

How can legend entries be obtained from different plots in a groupplot?

I would like to place a legend outside an axis using symbols from multiple plots within a groupplot. Trying it the way I show below doesn't seem to work, just the last entry is shown. How can this ...
12
votes
1answer
328 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?
12
votes
1answer
440 views

pgfplots: Coloring a Single Column in a Histogram Differently

I have a huge data file and want to visualize the data using histograms. I would like to color a single columns differently than the rest. Here's an example from the documentation (Section 5.11.2 ...
11
votes
3answers
3k views

Label a single coordinate (pgfplots)

I have the following plot: \begin{tikzpicture} \begin{axis}[grmin=-5:5 -5:5] \addplot[mark=none] {x^2/4}; \addplot[mark=none] {-1}; \addplot[mark=*] coordinates {(0,1)}; ...
11
votes
2answers
6k views

Histogram with Tikz

I am a newbie in TeX. And I need to use Tikz to make a copy of this histogram Of course, I am able to make something similar. Unfortunately, I need a replica (90%) of it. Can anybody help me? ...
11
votes
3answers
447 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
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
4answers
744 views

Plot the cusp catastrophe surface

I'm trying to draw (plot) the Cusp catastrophe surface into latex using any software logic. I am completely stuck because I'm definitely not a mathematician. The surface has the potential: V(x) = ...
11
votes
2answers
631 views

How can I create a polar plot on a Cartesian grid?

I'm currently using tikzpicture and pgfplots to plot this polar function: \documentclass{article} \usepackage{pgfplots} \usepackage{tikz} \begin{document} \begin{tikzpicture} \begin{polaraxis} ...
11
votes
4answers
1k views

Plot inverse function in pgfplots

pgfplots is not quite comfortable plotting sqrt(x) near x=0. The graphic can be improved by setting samples=2000 (not less), but this seems overkill to me. Is there a way to plot x as a function of ...
11
votes
2answers
1k views

plot 3d graphs of functions defined implicitly

How can I plot 3d graphs of functions defined implicitly (quadratic forms, for Linear Algebra course notes -- I'd like to include lots of examples)? As far as I can see it is not possible with ...
11
votes
2answers
2k 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
768 views

Unexpected clash between babel and pgf spy

The following example taken from the pgfplots manual (p. 121) works fine only if the line loading babel is commented \documentclass{article} \usepackage[frenchb]{babel} % this is the troubelsome ...
11
votes
2answers
2k 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
2answers
5k 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 ...
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
918 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
710 views

How can I plot two lines in the same style (using cycle lists) with pgfplots?

I am using cycle lists and the \addplot+ command to plot lines in different styles. I would like to plot several things using each style, however, like this: % Plot using style 1 \addplot+ ...
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
2answers
1k views

pgfplots: Grid Lines below Filling

I want to fill the area between two curves and have the grid lines below the filling. Is this possible? (From Showing grid on top of plot fill with PGFplots? I thought axis on bottom might work, but ...
11
votes
2answers
1k views

Background color in pgfplots that extends beyond the axis of the plot

I am interested in adding a background-color to my pgfplots plot that extends beyond the axis of the plot. See the image bellow for clarification; I am interested in adding a background color such as ...
11
votes
2answers
2k views

Compiling a document with PGFplots processing only every x-th data point? [duplicate]

Possible Duplicate: How to select a finite number of samples from the file when plotting using pgfplot Compiling my document with many PGF Plots, each containing thousands of data points ...
11
votes
1answer
9k views

Legend in tikzpicture

I am looking for a way to create a legend in a regular tikzpicture. I found this Using a pgfplots-style legend in a plain-old tikzpicture but I don't know how to put the legend at the wanted ...
11
votes
1answer
3k views

pgfplots line colors

Is it possible to make pgfplots use a predefined color map while plotting multiple lines, I currently have 9 samples that I want to plot, but don't want to type different colors for each one. Right ...
11
votes
1answer
17k 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 ...
11
votes
2answers
1k views

How to control pgfplots axis scaling for engineering notation (multiple of 3 exponent)?

The automatic power-of-ten scaling of pgfplots is a great feature that unclutters the numeric ticks in the axis (see image). However since the exponent value (e.g. 10^3, 10^4) is difficult to keep ...
11
votes
2answers
213 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
2answers
472 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 ...
11
votes
1answer
2k views

PGFPlots: Change the color of axis lines

I want to change the color of the axis lines only without changing the color of the axis labels, tick labels etc. MWE: \documentclass{standalone} \usepackage{tikz} \usepackage{pgfplots} % ...
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 ...
11
votes
1answer
6k views

pgfplot: Datafile format for datetime field

I have a datafile (which I may manipulate to any format), it contains a date-time stamp currently in the form "year-month-day hour:min" and a single variable for each recorded time. When I attempt to ...
11
votes
1answer
4k views

Chart with long x axis text labels looks ugly

Thanks to Caramdir and Alan Munn I am now able to create basic bar charts that use text as x axis labels. Functionally they are perfect, but some of them look kind of ugly. See for yourself: ...
11
votes
1answer
737 views

How to jam the axis of a pgfplots plot?

I need to have some kind of jump on the axis of the plot in pgfplots package. Something similar to the following figure where some part of the scales are jammed. It would be interesting to have ...
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, ...
11
votes
2answers
2k views

How to access \xmin, \xmax, \ymin, \ymax from within PGFplots axis environment

In the MWE example below I have the values specified twice, but would prefer not to have to do that. Furthermore, it is possible to allow PGFplots to automatically select these end points so I would ...
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);
11
votes
1answer
197 views

I am trying to add a trend line to this plot

I have this graph: \documentclass{standalone} \usepackage[utf8]{inputenc} \usepackage{textcomp} \usepackage{pgfplots} \pgfplotsset{width=10cm,compat=1.9} \usepackage{filecontents} ...
11
votes
1answer
847 views

How to plot the first n rows of a table using pgfplots?

When using pgfplots, is there a way to plot only the first n rows of a given table ? Considering the following MWE file: \documentclass[tikz]{standalone} \usepackage{tikz} \usepackage{pgfplots} ...
11
votes
1answer
630 views

Why does \mathbb{R} cause '! Undefined control sequence. - \GenericError'?

When I compile the following document, I get ! Undefined control sequence. \GenericError ... #4 \errhelp \@err@ ...
11
votes
1answer
386 views

Problem with legend in pgfplots

I want to make plot with fill area. I try this code \documentclass[a4paper,12pt]{report} \usepackage{pgfplots} \definecolor{plotmain}{HTML}{97bbcd} \pgfplotsset{every axis legend/.append ...
11
votes
1answer
2k 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? ...
11
votes
1answer
286 views

pgfplots: two axis for one dataset e.g. °C and °F

I want to plot ONE dataset in a pgfplots and use TWO axis with different units on each axis. For example I have one dataset with temperature and want to print a °C scale on the left and a °F on the ...
11
votes
1answer
2k views

pgfplots: reduce tick density

I am using matlab2tikz to produce plots in latex. The default tick settings produce very dense ticks, making the axes look ugly. I know that I can use something like /pgfplots/xtick={0, 1, ... 3} ...
11
votes
2answers
2k views

Pgfplots axis, option to remove (or ignore) legends

Is there an option in pgfplots at the axis level or a setting of legend style option, that would effectively ignore the subsequent legend entries in the plot? \documentclass{article} ...
11
votes
1answer
742 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 ...