{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

4
votes
1answer
2k views

How can I change the number of major tick labels? (pgfplots)

I would like to keep only the year number when scaling up and omit the 200x.5 or any other appearing figures. MWE \documentclass{scrartcl} \usepackage{ pgfplots, amsmath } \usepackage[T1]{...
4
votes
1answer
333 views

Legend on second frame has only one entry, labeled wrong

Using pgfplots in beamer with \only frames, the legend for the second frame (only) inexplicably shows only one entry, with the color of the last \addlegendentry, but the legend of the first. The other ...
4
votes
1answer
356 views

How to adjust the y-axis of pgfplots

In the right pgfplots, I hope that it could have (0, 10000,20000,30000,40000,50000)[in normal scale], rather than (1000,10000) [in log scale] now, how should I do that? This the the code \begin{...
4
votes
1answer
2k views

pgfplotstable manage strings and values

I like the pgfplotstable package for reading and plotting tables but handling of strings and values (especially when strings contain spaces) drives me crazy... I often use a table as shown here: \...
4
votes
1answer
464 views

How can the margin around externalized pgfplots crossrefs be set?

When using \usepgfplotslibrary{external} to externalize refs to labels in a pgfplot, the resulting .pdf looks cropped when the linewidth used for the line corresponding to the label is thick (or ...
4
votes
1answer
177 views

Using remember picture with pgfplots

The two rectangles in the example plot, by my reckoning, should overlap exactly. I would be most grateful if somebody could explain why they don't! My presumption is that this is a bug in my TikZ ...
4
votes
1answer
196 views

pgfplots Axis-Subsections on X-Axis on a bargraph?

I am trying to get pgfplots to draw some bargraph like this: but I cannot figure out how to get pgfplots to add the second X-axis-labeling so I could actually draw the data in a way that would be ...
4
votes
1answer
822 views

pgfplots and linear regression with semilogyaxis

I would like to add a linear regression line to my plot. The MWE is: \begin{document} \pgfplotstableread{ Year ICumCDP 2008 3.73E-07 2009 3.35E-07 2010 2.01E-07 2011 3.88E-07 2012 1.36E-06 }{\...
4
votes
1answer
543 views

How to plot data from multiple filters using pgfplots

I'm searching for a way to apply multiple filters to a data input and plot the result of each filter in one axis environment. I found the following question which applies one filter but uses the ...
4
votes
1answer
258 views

How can I setup my data so I can create pgfplots boxplots and update the x-indices for multiple series?

I have been using this box plot code to great effect recently. I am making a large amount of plots in my thesis and would like to be able to do the following data format: \begin{filecontents}{dataOne....
4
votes
1answer
981 views

How to manually draw horizontal legend and place it correctly in tikz?

This is my tikz code to draw some plots. \documentclass{article} \usepackage{tikz,subfig} \begin{document} \begin{figure} \centering \subfloat[Iteration Domain for a Tile]{ \begin{...
4
votes
1answer
922 views

Spacing bar between bars is too high in a bar plot with error bars [closed]

\documentclass{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ title = {ring enrich.}, ybar, width=10cm, xtick={1,2}, xticklabels={% before, after, }] \...
4
votes
1answer
1k views

Tikz bar plot problem: Missing number, treated as zero \end

I have been trying to plot the figure: by using TikZ. However, the code does not compile and I get many errors on line 48, which is \end{axis}, as follows: Dimension too large Missing number, ...
4
votes
1answer
2k views

Placing extra x tick on the upper axis

Please consider the following MWE. In addition to the xstick of the bottom x-axis (or primary x-axis) I would like to add a extra tick at the upper x-axis (or secondary x-axis). \documentclass{...
4
votes
1answer
389 views

How to have extra row of tick labels appear only once per row of plots?

This is a follow up to How to add another row of tick labels? I currently have another row of tick labels for every plot in a group of plots. What I want to do is to have the descriptions for the ...
4
votes
1answer
781 views

How to add axes in a magnified part of a graph using spy?

My problem is the following. I would like to draw the (magnified) axes on the magnified area of spy. For instance, take the following example (from pgfplots.pdf, p.121): % Preamble: \pgfplotsset{...
4
votes
1answer
857 views

Wrong scale in a stacked ybar logarithmic plot with basis 10 using package pgfplots

I want the plot described in the title. So I added options log basis y=10 and ybar stacked to the axis environment. The scale becomes wrong. If I add just one option, the scale is right. Is my ...
4
votes
1answer
969 views

pgfplots: stacked plots using absolute values instead of relative

I would like to use absolute coordinates instead of relative values when using a ybar stacked plot. Is this possible? I know I can just reformat my data to be relative, but it sounds like pgfplots ...
4
votes
1answer
67 views

define color in pgfplots

I want to plot funtions and data with own colors using \definecolor{<name>}{<model>}{<value(s)>}. If I use this command in \tikzpicture it works. But if I use this command in ...
4
votes
1answer
86 views

Plotting ranges of data with tikz or pgfplots

I have a sample with countries and data. I would like to have a "comb" graph to show the years covered in the sample for each country. My data is like this : ####################################...
4
votes
1answer
51 views

Trouble with pgfplots ternary diagram

I've been trying to help my wife with a ternary diagram that she needs for her master thesis, but I'm having unexpected trouble with pgfplots. The following code, which I got from an answer from ...
4
votes
1answer
59 views

Adding number from text file to axis label

I have a bunch of standalone tikz images that I need to add a number to the axis label. The number that I add to each label is in a text file that may change depending on which dataset I use. Is there ...
4
votes
1answer
53 views

pgfplotstableread{mydata.csv} VS table {mydata.csv} efficiency and capability for csv files pgfplots

I am trying to plot a very large .csv file with multiple columns using pgfplots. I want to use the first column for all my plots. My usual routine is to do something like: \addplot [solid] table [x=A,...
4
votes
1answer
61 views

Duplicate values on the x-axis

I'm having problems with this simple bar-chart graph in LaTeX. Why are the years on the x-axis duplicated for values 2017 and 2018? How can I have only 3 bars on the x-axis? \documentclass{book} \...
4
votes
1answer
162 views

Watercolor in tikz

Is it possible to fill a shape with a coloring that looks like watercolor like in this image using tikz or pgfplots? Src: http://bartoszmilewski.com/2015/07/29/representable-functors/
4
votes
1answer
343 views

pgfplots external with large dataset (lualatex?)

I have fairly large datasets with densely strucutred data that i cant downsampe much without loosing structure. I use TexMaker on Ubuntu 14.04LTS. I use \usepackage{tikz,pgfplots,pgfplotstable} \...
4
votes
1answer
93 views

How to load extra ticks form CSV file

I have the following following document, where the extra x ticks are defined manually. However, I want to have the ticks generated from the CSV file where the second column is 1 because the real ...
4
votes
1answer
282 views

Adjusting 3D-view in pgfplots by custom transformation matrix for multiple axes

I'm trying to overlay two axis environments in a tikzpicture for adjustable views. In principle this wouldn't be a big deal - but, I would like to use this technique for the projection e.g. of text ...
4
votes
2answers
211 views

Scaling a plot axis to keep the same size unit vectors over multiple plots

I have a PGFplots set of grouped plots that somewhat resembles the following MWE. The top row of plots has a larger range than the bottom row. Is there a way to have the height of the top row ...
4
votes
1answer
228 views

Generating pgfplots legend from gnuplot data

I’m having trouble getting pgfplots to typeset very small numbers, e.g. 6.82e-08. I don’t know if the problem lies in it being a very small number, or if it’s because of the interaction with reading ...
4
votes
1answer
880 views

Invoke gnuplot through pgfplots to get a matrixplot

I have a code which gets two parameters and depending on them the code has different runtimes what I want to illustrate in a matrix plot. I'm writing the thesis in LaTeX the obvious method for me, ...
4
votes
1answer
746 views

Multiple plots with error bars

I want to plot two graphs with error bars from an external file. The data file contains the columns x, y1, y1+, y1-, y2, y2+, y2-, where y1+ etc. are the error bars for the corresponding y-values. ...
4
votes
1answer
251 views

How to have different colormaps for different columns in the same Heatmaps table using pgfplots

I want to make a heatmap using different colors for only two columns in a heatmap. I was able to do it using two different pgfplotstables, i.e, two different heatmaps. But, i wan't to know whether i ...
4
votes
1answer
502 views

Metadata for different colours in PGFPlots

I would like to use PGFPlots to create a plot using three sets of metadata. I figure it would be best to have one set represented by the plot mark and the remaining two by the fill and draw colour ...
4
votes
1answer
395 views

pgfplots - divide y-axis in 2 parts

I have a plot, code here. Now the problem I have is that because of the scale of y-axis it looks as if the plots are actually just 3 lines. Now what I want is that the y-axis is sort of splitted. Into ...
4
votes
1answer
362 views

pgfplots: Plot only parts of table and in “random” order

I have been lurking around stackexchange for a long time and so far been able to find solutions for my newbie problems but now I'm really stuck! My problem is probably not that complicated, yet a bit ...
4
votes
1answer
572 views

PGFPLOTS 3d box line for Z axis not being drawn

The vertical 3d box line for Z axis is not being drawn. If I make the grid lines dashed, the line is drawn, but also appears dashed, as the grid lines. To me, it looks that the line is in fact drawn, ...
4
votes
0answers
38 views

pgfplots: Plotting one subfigure per country, from datafile

I have data in csv format at the country-year level, and using pgfplots I would like to plot a given variable over time, with one subfigure per country. My idea was to use a groupplot environment: and ...
4
votes
0answers
51 views

Tikz/pgfplot: draw option to plot a plot file at given position

I would like to use the draw function of the tikz package to plot a 2D experimental data at a given z altitude. Since I am using some kind of projection view, I would like to fix the z position of ...
4
votes
0answers
52 views

pgfplots: math expressions of variables in axis style

I would like to use a calculated value of pgf variable exp(\pgfplots@data@xmin) This is a concrete example what I need \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \...
4
votes
0answers
90 views

Normalized histogram (density) in pgfplots

I have a data file containing 100 256 values ranging from 0.01 to 3, approximately. I would like to plot the density of this data set. I have the theoretical (asyptotic distribution) drawn for ...
4
votes
0answers
72 views

Pgfplots Tick Position [duplicate]

Similar to this question, I want to hide some ticks in a pgfplots axis. However, I'm trying to manipulate a 3D plot. I used the proposed answer and reread the documentation at: "4.15.2 Tick Alignment:...
4
votes
0answers
127 views

Calculate x-coordinate for given y-value by interpolating data from pgfplotstable

I have a text file data.txt with the following content: -2 -2 +1 +0 +1 +3 +2 +4 +2 I read it with \pgfplotstableread{data.txt}\data and then plot the second column by the first column with \...
4
votes
1answer
73 views

pgfplots wrongly calculate \pgfplots@data@xmin in the case of mixed plots (with and without error bar)

In this TUGBoat article the author show how to implement tufte style plots with pgfplots. Currently I am working with Lualatex,texlive 2015. In the following MWE I implemented the idea from the ...
4
votes
0answers
191 views

Drawing Cross Sections of (Contours over) Torus

I have this simple torus \begin{figure} \begin{center} \begin{pspicture}(-6,-4)(6,4) \psset{viewpoint=30 10 25 rtp2xyz,Decran=30,lightsrc=viewpoint} \psSolid[object=tore,r1=2.5,r0=1.0,ngrid=36 72,...
4
votes
0answers
132 views

Setting Folder for Data pgfplots in LyX

I'm trying to get a figure in my LaTeX document, but I struggle to set the search-path I use \addplot[blue] table {invcum.dat}; from the example, however it keeps saying ! Package pgfplots Error: ...
4
votes
0answers
170 views

Conflict tikzscale and matrix group plot

I want two axis environments next to each other in one figure environment. I want them to be vertically aligned and scaled to the width of the text. I am trying to achieve this by means of the ...
4
votes
0answers
319 views

Automatically positioning a legend relative to multiple plots in groupplots

This question deals with centered legend placement in a set of plots aligned with groupplots. However, as the OP stated in a comment, the (accepted) solution requires some hand tweaking. I suspect ...
4
votes
0answers
134 views

PGFplots 3D: Axis labels are placed “in the middle” of axis instead at the tip

I would like to use the "center"-style for axis and place the label of the axis near the arrow tip. It works in 2D but in 3D the labels for the x and y axis are placed at very weird places. See the ...
4
votes
0answers
219 views

How to draw the vectors from point to point

I have the file "gradmethod.dat" that contains the values ​​of the 3D coordinates: "gradmethod.dat" is 0.4166337995 -0.0003214561 0.1735863062 0.0036860331 0.0076438475 0.0014742969 0....