# Tagged Questions

{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.

581 views

### Pgfplots: 3D plot with shader=interp and opacity

I have a rather simple question : is there a way to use shader=interp with an opacity factor in a surf mesh ? Here is an example that does not work: \documentclass{standalone} \usepackage{pgfplots} \...
298 views

### Clipping 3D plots using pgfplots

This is a follow-up question to Plotting a function on a triangular domain using tikz. I am interested in plotting three functions on a triangular domain, specifically x*y (2*x*x+2*x+2*y*y-2*y)/(2*...
264 views

### Interpolate grid data to obtain 3d smooth surface

I use this code \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \begin{document} \pgfplotsset{ ytick={0,0.2,...,1}, xtick={0,0.2,...,1}, xlabel={$x$}, ylabel={$y$}, zlabel=...
306 views

### Pgfplots: Addplot color depending on sign

I want to create a plot where positive and negative values have a different color. MWE: \documentclass[tikz]{standalone} \usepackage{filecontents} \usepackage{xstring} \begin{filecontents}{data.txt} ...
311 views

### how to set properly ymax and ytick

I'm trying a plot the left y-axis from 0.5 to 0.88 with 0.88 at the top border of the box (like the 160 at the 2nd y-axis). But even to get 0.88 I have to set ymax and (the last ytick) to 0.9 and it'...
196 views

### zmin axis value for a 3d plot in TikZ

If I plot this the z axis does not start at 0 but somwhere negative. How do I fix this? \documentclass[border=2pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \usepackage{tikz} \...
187 views

### How to make logarithmic axis “readable”?

How can I make a logarithmic axis more readable? I have many plots that look similar to this one: The problem is in the y axis. Anyone can imagine what 10^5 represents, or 10^6. It is not so easy ...
3k views

### PGFplots - single legend in a group plot [duplicate]

I have a group plot and when I try to add a legend it repeats on all subgraphs. I want a single common legend line at the top of the whole graph. \documentclass{standalone} \usepackage{graphicx} \...
259 views

### How can I add zero lines to a groupplot?

I'd like to add zero lines to a groupplot by defining them once in the groupplot environment. I of course based this on the clues and replies I found on here & in the manual, but so far I couldn'...
180 views

### Data manipulation in contour maps (x/y-axis and contour label)

I am using contour maps in pgfplots as part of CAD as well as documentation. Serving both purposes I would like to improve the readability of my contour maps, by multiplying x- or y-axis times a value....
252 views

### changing the 3D tick style of pgfplots

Consider this 3D plot: \documentclass{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} \addplot3[surf,domain=-4.5:4.5]{(x^2)-(y^2)}; \end{axis} \end{...
468 views

### 2D Bar Chart in 3D Space

I have a graph in 3D space and I'd like to add a histogram along the vertical axis. The bars are supposed to be spaced equally along the vertical axis. I am, however, unable to get the positions of ...
670 views

### Linear regression in a loglog-plot with fixed slope

Goal: create a plot to compare the empirical convergence rate of a numerical method with the one expected from the theory. Accordingly, given a loglog-plot, I would like to add the line which has a ...
178 views

### Ugly two ordinates plot

For some reason the plot generated from this code looks extremely ugly. The two series look like they were hand-painted. I thought the smooth property would help but still the same ugly plot. \...
201 views

### plotmarks are displayed as default marks

My code: \documentclass{article} \usepackage[ngerman]{babel} \usepackage[utf8]{inputenc} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \usepgflibrary{plotmarks} \begin{document} \begin{...
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]{...
338 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 ...
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{...
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: \...
467 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 ...
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 ...
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 ...
853 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 }{\...
557 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 ...
263 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....
1k 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{...
935 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, }] \...
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, ...
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{...
393 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 ...
796 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{...
859 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 ...
978 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 ...
466 views

### pgfplots ycomb width

Is there a simple way to control the width\thickness of the strokes in the ycomb/xcomb commands proposed in pgfplots? Or should I dive into the source code to clarify?
56 views

### Embedding pgfplots' plot3 into a tikz-3dplot

I'm trying to embed a 2D Gaussian into a tikz-3dplot, but I'm having problems transforming the coordinate systems. As a simplified example, I'm plotting a plane in pgflots' \addplot3 and I'm embedding ...
80 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 ...
88 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 : ####################################...
52 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 ...
62 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 ...
54 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,...
66 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} \...
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/
378 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} \...
94 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 ...
290 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 ...
237 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 ...
232 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 ...
921 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, ...