{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

7
votes
2answers
682 views

Spacing between image and text in pgfplot legend

Using the following code: \begin{tikzpicture} \begin{axis}[ xmin=0, xmax=4, ymin=0, ymax=10, width=9cm, height=6cm, legend style={draw=none}] \addplot[only marks,color=red] coordinates { (0, 10) (0....
3
votes
1answer
343 views

Marking (multiple) intersection points sinus function and constant function

The intersection of a sinus and a constant function, has multiple results. So my question is how to mark these points. My code \documentclass[11pt,a4paper]{article} \usepackage{geometry} \geometry{...
8
votes
1answer
2k views

Does pgfplots ignore the minor grid?

I'm trying to plot an easy function and I would like to enable the minor grid. But it seems that this instruction is ignored. I used the grid=both option but it has no effect. The only grid I can see ...
8
votes
1answer
4k views

grouped bar chart with pgfplots

I am trying to create a grouped bar chart with pgfplots, like this one: but I can't put the values over the bars, like this one: My code is: \documentclass{article} \usepackage{pgfplots} \...
5
votes
1answer
157 views

Plot using pgfplots from a text file in long form (vs wide form)?

In the statistical programming language R, there are two different forms to represent data. The wide form looks like the following: subject time age weight height 1 John Smith 1 33 90 ...
6
votes
1answer
1k views

unit circle sin(x) radians on x-axe [duplicate]

Adapting the code from another question, but still having one problem: \documentclass[11pt,a4paper]{article} \usepackage{tikz} \usepackage{tkz-euclide} \usepackage{pgfplots} \usetikzlibrary{calc} \...
0
votes
1answer
843 views

Import selected rows without header in pgfplots

Import of selected rows of a data set (without header line) The import should make use of the column numbers instead of row headers. The pgfplots' manual presents the possibility to use the command \...
2
votes
0answers
287 views

Histogram improvement or to plot histogram in 3D

I have created this histogram! I wanna ask: Can I further improve it as at one "normalized frequency, 41" I have two "frequency shift values, 4 and 11"? Is it possible to plot such histogram in 3D, ...
6
votes
1answer
141 views

Incorrect plot values using pgfplots

I'm trying to plot the following function: \begin{tikzpicture} \begin{axis}[ ymin = 0, width=17cm, height=19cm, grid = major, use units, x unit=mm, y unit=j.u, xlabel=x, ylabel=I] \addplot[...
7
votes
1answer
1k views

Single stacked bar, values and legend

\documentclass{article} \usepackage{pgfplots} \begin{document} \pgfplotsset{testbar/.style={ title=strookdiagram sporten, xbar stacked, width=10cm, axis y line*= none, axis x line*= bottom, ...
1
vote
0answers
163 views

inserting tikzstyle objects into sty files [closed]

I am trying to put a tikz object (pie chart) into the sty file so it will update its shape as the presentation proceeds (instead of \insertframenumber/\inserttotalframenumber). the code for the pie ...
4
votes
0answers
574 views

Multiple ternary plots and pie charts in pgfplots

I'm trying to plot lots of ternary plots and pie charts. Ideally it should look smth like this: The pie-chart (ternary plot) on the left-hand side serves as an explanation of what is happening, ...
7
votes
3answers
695 views

histogram + frequention polygon

This is my code \documentclass[11pt,a4paper]{article} \usepackage{tikz} \usepackage{tkz-euclide} \usetikzlibrary{calc,intersections,through,backgrounds,snakes} \usepackage{pgfplots} \pgfplotsset{...
5
votes
2answers
231 views

Reuse a series style in PGFplots

I have a lot of PGFplots in my document with a consistent style throughout, managed through a shared cycle list. Now I'd like to re-use a previous plot style within the same PGFplot. As an example, ...
8
votes
2answers
295 views

Using plot instead of text in pgfplot legend

I am curious if it is possible to use a custom image (e.g. plot) instead of text inside the legend of a chart generated with pgfplots. Specifically, given this MWC: \documentclass{standalone} \...
1
vote
0answers
311 views

PGFplots - bold nodes only at ticks [closed]

The following code produces the diagram below: \begin{center} \begin{tikzpicture} \begin{axis}[date coordinates in=x, axis background/.style={fill,bottom color=gray!50,top color=white}, ...
3
votes
2answers
698 views

Create groupplot 3 x 6

I asked a similar question before: Create 2x2 groupplot with +1 plot to the side? For that time using the subfigure environment wasn't a problem. But I do not want to use the subfigure environment ...
6
votes
1answer
121 views

Strange result in plotting data using pgfplots

I'm trying to plot this: \begin{tikzpicture} \begin{axis}[ height=5cm, width=\linewidth] \addplot[smooth,blue] plot coordinates { (27,177) (28,223) (29,240) (30,227) (...
3
votes
1answer
2k views

Latex fonts causing “Undefined control sequence” error in pgfplot

I am trying to modify the font size of some text labels in a pgfplot graph I'm playing around with, but it seems pgfplot doesn't understand certain font sizes such as \normal etc. Yet the pgfplot ...
1
vote
1answer
704 views

Positioning of node label in pgfplot

I am using pgfplot to make a 2D plot with the nodes labelled. However, some of the text labels interfere with each other as they're too close. The default positioning of text labels in pgfplot seems ...
9
votes
1answer
810 views

Plot a triangular grid inside of a hexagonal grid?

I have made the following grid: With the following code: \documentclass{standalone} \usepackage{tikz} \usetikzlibrary{shapes} \begin{document} \begin{tikzpicture} [hexa/.style= {shape=...
7
votes
1answer
368 views

pgfplotsset{compat=1.9} causes y=0 error bar to disappear

I am producing a stacked bar chart or two series with error bars that describe the uncertainty in their sum. I apply the error bars as properties of the second plot. If I use \pgfplotset{compat=1.9},...
1
vote
1answer
774 views

Reduce vertical distance of “above right” to label a plot

How can I label a plot using above right but with reduced vertical distance? I tried a syntax like above right= value1 and value2 but this isn't working for me. For example in the following plot: \...
6
votes
1answer
139 views

Reference to pgfplot with margincap

I was using references to parts of a pgfplots plot, which worked perfectly. However, when I changed the document to use margincaps, this breaks: I get a warning that one reference is undefined, and ...
12
votes
2answers
1k 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} \...
3
votes
0answers
589 views

pgfplots 1.9 on Mac [closed]

I have an iMac with TeX Live 2011. It came with pgfplots version 1.4, which I am able to use without a problem. I just downloaded pgfplots version 1.9 which has new environments like polar axis, smith ...
5
votes
1answer
127 views

How to prevent extra yticks within a Tikz Grid?

I created a nice scatter diagram based on the example at http://www.dgsiegel.net/news/2011_12_05-creating_beautiful_graphics_with_pgfplots. The problem I have now is that in order to show all the y-...
6
votes
1answer
463 views

Tick labels in pgfplots data time format

I tried to plot a data set containing seconds and milliseconds with pgfplots. I’ve found a solution for my task here (pgfplots data time format), which I changed a bit. This principally works very ...
2
votes
0answers
500 views

How to make a tidy grouped and stacked barchart?

I found this chart in a recent paper. I've emailed the author about it but they didn't reply. I want to create something similar but I don't know what the correct software to use is. I need the ...
3
votes
0answers
197 views

How to color groups of bars in a graph, coming form an external file?

I have a graph displaying bars and error bars, the numbers comming from an external .dat, being simply black and white. And this is how I got there: \documentclass[12pt]{report} \usepackage{...
5
votes
1answer
270 views

labels disappearing in pgfplot bar chart

Only the third label appears for this bar chart. If I put only one data row, the label shows up fine. If I put two data rows, both the labels are hidden. If I put three data rows (as below), only the ...
4
votes
1answer
388 views

How to define optional arguments for custom pgfplots style

I see from other question that it is possible to create styles with parameters. Like \pgfplotsset{ custom style/.style 2 args{ % code that uses #1 and #2 } } However, I can't find a way of ...
6
votes
2answers
655 views

Path with complicated colormap in TikZ

I want to draw a path in tikz whose local color is a function of position. Here are two examples of what I have in mind: I found the answers from Path following color gradient in TikZ very ...
3
votes
1answer
99 views

Label placement in pgfplots

I want to have the label arrows look that I get when using axis lines=center but I also want my x and y label to be on the outside of the plot and not inside the actual plot area. I have been looking ...
0
votes
1answer
757 views

How can I draw with coordinates of intersection in pgfplots?

When using pgfplots, the command \pgfgetlastxy works well without axis environment and with axis environment set as default. But it is hard getting the correct coordinate of intersecting, when ...
4
votes
1answer
2k views

Collapse range in x-axis with pgfplots? (break x-axis)

I want to plot data from a table file. The data has quite big gaps in the x-axis, making the actual data barely readable. Is it possible to tell pgfplots to kind of collapse the x-axis in a given ...
5
votes
1answer
540 views

Horizontal lines in bar plots without first line

I'm starting to learn pgf-plot and this is my first plot: \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \begin{document} \begin{tikzpicture} \begin{axis}[ ybar, ...
3
votes
0answers
479 views

Error using “x expr” in “\addplot table” options [closed]

I have not been succesfull using x expr in \addplot table options, within Tikz/pgfplots. I don't think the problem is with the package being installed or not, because I have been using \addplot table ...
6
votes
2answers
443 views

Bug pgfplots extra ticks? [closed]

I want to add some extra ticks to a plot. However, they seem to bug out with formatting numbers. \documentclass{article} \usepackage{tikz,pgfplots} \begin{document} \begin{tikzpicture} \...
7
votes
3answers
3k views

How to draw legend lines in caption/text without including original plot's TikZ picture?

I would like to reference some plot lines in text/captions. It is possible by defining a label for the plot in the corresponding axis environment. However, I'm using externalization and only want to ...
2
votes
1answer
487 views

How to change location of boxplots along axis in pgfplots?

pgfplots draws boxplots equally spaced along the axis (x axis in my example below). How can I draw the boxplots at different locations along the axis? E.g., the example below the distance between the ...
5
votes
2answers
563 views

Pgfplots: Error of Linear Regression

Hope you don't mind me asking this, I'm only a starter at both gnuplot and LaTeX, but I've already searched the pgfplots manual and couldn't find an answer: Is it possible to have pgfplots calculate ...
30
votes
2answers
3k 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 ...
2
votes
1answer
209 views

Disable decoration for pgfplot nested in tikzpicture

I have the following MWE: \documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations,decorations.pathmorphing} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \begin{document} \begin{...
6
votes
2answers
5k views

Pgfplots circles

I'm having a little trouble drawing circles in pgfplots. Here is my code and then I'll explain: \documentclass{article} \usepackage{amsmath} \usepackage{pgfplots} \usepackage{color} \usepackage{tikz}...
10
votes
3answers
429 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} \usepackage{...
3
votes
1answer
387 views

Add arrow to 3D pgfplot

How to add an arrow (cf red arrows below) in a 3D plot (or 2D plot should be similar) in pgfplots ? The arrow has not to be specifically aligned with the label but could be placed closer to the axis.
2
votes
0answers
408 views

Set xticks, yticks and colorbar tikz at once [closed]

I couldn't figure it out how I can manually set the xticks, yticks as well as those ticks of the colorbar at once. It only works for one of those three, but compiling never ends if I try to change a ...
0
votes
1answer
304 views

pgfplots tick lines are behind const plot

The tick lines in the plot are in a layer behind the actual plot. Have a look at this example below: \documentclass[11pt, oneside]{article} \usepackage{tikz} \usepackage{pgfplots} \begin{document} ...
2
votes
1answer
328 views

How could we fix the legend in the x-axis with bar chart?

How could we fix the problem with the x-axis ? Also, would it be possible to have written above or in the middle of each column each number ? So as to make my bar chart, I have used the following ...