{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

10
votes
1answer
406 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 ...
10
votes
1answer
467 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. ...
10
votes
1answer
2k views

pgfplots using strings *from data table* as x axis labels in bar chart

I've seen some of the other threads on using strings as x axis labels, but nothing that fits my situation. I'm trying to create a bar chart from a CSV file. I can do it so long as everything in the ...
10
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 ...
10
votes
1answer
520 views

Tabs in output file written by xelatex and pdflatex are different

I'm trying out pgfplots with gnuplot to generate the data. This works by having pgfplots write some stuff to an external file, run gnuplot on the file, and then use the generated data to plot the ...
10
votes
2answers
4k views

How to plot data from a CSV file using tikz and csvsimple?

Here is a minimal example : \begin{filecontents*}{data.csv} a,b,c,d 1,4,5,1 2,3,1,5 3,5,6,1 4,1,4,9 5,3,4,7 \end{filecontents*} \documentclass{article} \usepackage[utf8]{inputenc} ...
10
votes
2answers
2k views

Reversing direction of x axis in pgfplots

I want to reverse to direction of the x axis in one of my plots. pgfplots offers the x dir=reverse key for this. However, this does not work as expected - not even in this example: ...
10
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 ...
10
votes
2answers
2k views

tikz/pgfplots advanced z-order axis/grid

Is it possible to have both the axis on top and the grid on the very bottom (or somewhere in between some other planes/lines/...) of a plot? Example figure with axis on top=true but the grid on top ...
10
votes
3answers
4k views

Restrict function plot to a range of x values using pgfplots.

I want to create a plot of two functions using pgfplots and LaTeX. I want one of the functions only in a certain interval, I'll give an example: \begin{tikzpicture} \begin{axis}[ axis x ...
10
votes
1answer
2k views

Is it possible to create overlays in beamer inside pgfplots graphics?

When working with pgf-tikz, I can create overlays in beamer presentations with \path<overlay specification> ... However, I could not get this to work in pgfplots graphics. It would be nice ...
10
votes
2answers
95 views

Convert from physical dimensions to axis cs coordinate values

In answering PGFPlots: Howto draw a label at a zero of a function?, I got stuck on converting a length in pt to the actual coordinate value in the axis cs system. Here I only need the x value, but ...
10
votes
1answer
221 views

Compiling a tikzpicture including \ref

I've been reading and gathering material from multiple sources online about what steps are required to externalize a document that contains TikZ pictures which store a reference to their legends using ...
10
votes
1answer
612 views

How to make the tick thickness as the axis line?

I am trying to make the thickness of the ticks equal to the axis line thickness. That is what I have so far: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.5} ...
10
votes
1answer
1k views

pgfplots how to nicely place nodes

The picture produced by code blow, there are two problems I have. (1) the number above point overlapped (2) the precision of number is not right, eg. I want 0.913, not 0.91 For the first problem ...
10
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 ...
10
votes
1answer
948 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 ...
10
votes
1answer
899 views

Make pgfplots typeset axis units as reciprocals using siunitx

pgfplots has a library units that allows to typeset units in axis labels provided through x unit=<unit>. Through the key \pgfplotsset{unit code/.code={\si{#1}}}, it can be made to typeset the ...
10
votes
1answer
198 views

Solid sphere with a cylindrical hole through center (bead shaped solid)

I am trying to draw a solid sphere with a cylindrical drilled through its center. The best I have been able to do is: which does not show it is solid. How do I make it more solid in appearance? ...
10
votes
1answer
516 views

Unsung Heros - PSTricks, TikZ, pgfplots,

While watching presentations (mostly made with beamer) at my university I noticed, most people here use LaTeX to create there presentations which is really nice. (not just for the health of my eyes) ...
10
votes
2answers
310 views

pgfplots: get color setting from table

I want to plot multiple lines using pgfplots. Each of the lines should have a color, depending on the group it belongs to. In the example attached, a table is provided, containing all the ...
10
votes
1answer
2k 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 ...
10
votes
1answer
1k views

Z-Order of plots pgfplots

Simple question: I can’t seem to control the z-order (i.e. which comes in front, which comes in the back) of the plots in a 2D axis. MWE: \documentclass{article} \usepackage{pgfplots} ...
10
votes
1answer
815 views

Change grid line dash pattern such that grid intersections look uniform

We can set the appearance of the grid like follows: \pgfplotsset{ grid style = { dash pattern = on 0.05mm off 1mm, line cap = round, black, line width = 0.5pt } } The result may ...
10
votes
1answer
808 views

How can one plot in 3D a matrix with LaTeX?

I have a problem with drawing a 3d plot in TikZ. I have a matrix of size (n*m) n is the number of points in the x-direction and m is the number of points in the y-direction and the values in the ...
10
votes
1answer
160 views

Labelling (pinning) points in a plot automatically

I have a scatter plot that I am generating based on some data stored in comma-separated format. I need to add a label to each point: this information is available as part of the .csv file as it's used ...
10
votes
1answer
642 views

Space between bars, height and width of the plot

I'm using pgfplots to generate bar plots from data files. Here's MWE: \documentclass{article} \usepackage[ngerman]{babel} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ ...
10
votes
1answer
6k views

pgfplots axis scaling

Is it possible to define in pgfplots that y should correspond to Y cm in my plot? I know how to do this in tkz-fct, so let me add an tkz-fct example to make more clear what I want: ...
10
votes
2answers
961 views

Big data surface plots: Call gnuplot from tikz to generate bitmap and include automatically?

Motivation I have large numerical data files, that I would like to create density (surface) plots of. Since they are very big, we can rule out a few possibilities such as to plot them directly with ...
10
votes
1answer
463 views

Contour partially hidden by a surface in pgfplots

Thank's to SE (and particularly these two questions: Draw a bivariate normal distribution in TikZ and How to fix a contour plot at top of a 3D box), I've been able to draw what I was looking for with ...
10
votes
1answer
97 views

Climographs (climate diagrams) with pgfplots

I'd like to create climographs (climate diagrams) with pgfplots, but these graphs have some special rules (defined by Walter and Lieth about 50 years ago) for axis scaling which I have absolutely no ...
10
votes
1answer
577 views

TikZ datavisualization or pgfplots?

I want to create a few plots that should have the same style as my main document and it seems tikz is more than capable of achieving that. Now while browsing the current tikz documentation (2.10 ...
9
votes
3answers
845 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)}; ...
9
votes
2answers
2k 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? ...
9
votes
3answers
153 views

Use \macro within xcolor expression

So this seems to be impossible: OrangeRed!\c!white with \c being any kind of \def formula, or precisely in my case, with a \pgfmathsetmacro. Here is MWE \documentclass{article} ...
9
votes
2answers
2k views

Pgfplot axis labels

I'm trying to adjust the position of my axes labels and I'm having some trouble: \documentclass{article} \usepackage{float} \usepackage{pgfplots} \usepackage{graphicx} \begin{document} ...
9
votes
4answers
597 views

How do I shade an area in pgfplots?

How do I create a shaded area in a polygon created by plot intersections? In this case, up to the solid line without circle marks. \documentclass{article} \usepackage{pgfplots} ...
9
votes
1answer
7k views

Problem plotting histogram using pgfplots package

The following code plots a histogram using pgfplots. \documentclass[a4paper]{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \begin{tikzpicture} \centering ...
9
votes
3answers
380 views

How to draw two intersecting graphs?

I want to make the following figure. My efforts are: \documentclass{standalone} \usepackage{pgfplots} \usetikzlibrary{calc,shadings} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} ...
9
votes
2answers
482 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 ...
9
votes
2answers
151 views

Plotting Arrows Programmatically in Pgfplots

I'm having an issue where I would like to plot a series of evenly spaced arrows where the length is dependent on the values from a data file and I'm not particularly sure how to go about it. I would ...
9
votes
2answers
95 views

Creating a new environment containing a tikz environment

I would like to create a new environment in order to ease the process of making plots. It should be able to something like this: \begin{graph} \addplot [domain=-10:10, samples=1000]{x)}; \end{graph} ...
9
votes
2answers
156 views

pgfplots how to smoothen up a surface plot with coordinates

I have some coordinates not from some particular function... \begin{document} \begin{figure} \begin{tikzpicture} \begin{axis} [width=16cm,height=19cm,samples=100] ...
9
votes
2answers
1k 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 ...
9
votes
2answers
3k 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 ...
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. ...
9
votes
2answers
116 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
475 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 ...
9
votes
2answers
514 views

LuaLaTeX:PGFplots can't read data passed by Lua

I wanted to give a LuaLaTeX answer to this question Here it is the listing I wrote: % !TEX encoding = UTF-8 % !TEX program = LuaLaTeX % !TEX spellcheck = en_GB \documentclass{standalone} ...
9
votes
2answers
656 views

Is lualatex supposed to be a superset of pdflatex? (regarding production of PDF)

In other words, is it a bug if lualatex cannot compile a document that pdflatex can? Based on the answers to this question How to expand TeX's "main memory size"? (pgfplots memory ...