{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

29
votes
2answers
956 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
92 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} ...
4
votes
2answers
524 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} ...
9
votes
3answers
196 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} ...
3
votes
1answer
143 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
203 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 ...
1
vote
1answer
73 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
146 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 ...
3
votes
1answer
649 views

Draw a vertical line with filled areas and dateplot

I'like to add an vertical line with some text in a graphic, but i've not found the way. I tried something like \addplot coordinates { (2008-01-01,0) (2008-01-01,130)} node {some text}; but it ...
7
votes
1answer
1k views

pgfplots, bar graph, axis distance

I have a following chart, and I am trying to decrease the distance between the x-axis ticks FCC and Beta pi. Any suggestions on how to reduce this? \documentclass{standalone} \usepackage{pgfplots} ...
2
votes
1answer
115 views

unaligned groupplot

I tried to stack my plots with a groupplot from pgfplots package. Like in this MWE: \documentclass{article} \usepackage{pgfplots} \usepgfplotslibrary{units} \usepgfplotslibrary{groupplots} ...
7
votes
3answers
716 views

Weird result plotting sin(x) using tikz/pgf [duplicate]

Trying to plot the sin(x) function, I get this result: The MWE is here: \documentclass{standalone} \usepackage{ pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} ...
8
votes
1answer
69 views

Pgfplotstable ignores chars in filename

I am using the ignore chars key from the pgfplotstable to ignore some characters in a table. However, I have noticed that it also removes characters from the file name and I am wondering if this is ...
3
votes
2answers
226 views

Origin shift in pgfplots

I want to shift the origin in such a way as the following code will cause the circle to appear with center at the point marked in red. \documentclass{article} \usepackage{amsmath} ...
5
votes
1answer
132 views

pgfplots: Add main diagonal (identity line) without affecting the axis

I would like to add a main diagonal to a plot that does not affect the axis. The line should start and end at the axis or beyond them. Furthermore, I would like to avoid xminand xmax, because I work ...
1
vote
0answers
53 views

Citation in externalized pgfplots

I have a few \cite commands in my pgfplots which are not being displayed properly when externalization in on. As soon as you turn off the externalization, the references will be displayed correctly. ...
12
votes
2answers
356 views

TikZ: Regression Line with Residuals

Desired Output I made this diagram in R with ggplot2. Now I want to reproduce this diagram with Tikz. My MWE is: \documentclass[tikz]{standalone} \usepackage{pgfplots} \usepackage{pgfplotstable} ...
4
votes
1answer
139 views

Error using tikz/pgf with font=\size (and minimal document class)

I'm having an issue with pgfplots/tikz when trying to change the font size for legends/nodes. Any command that contains "font=\size" fails (for example, "font=\small") with the error "Undefined ...
3
votes
0answers
202 views

Normal probability plot with percentile grid and axis

How can I make a normal probability plot with a percentile grid and y-axis as shown in figure? I've read the pgfplots documentation but i can't find anything useful.
8
votes
1answer
367 views

Pgfplots linear regression (mean square error)

Pgfplots offers the possibility to compute a linear regression, as in the following post Linear regression - trend line with pgfplots . However, is it possible to compute the mean square error ? My ...
2
votes
0answers
60 views

combine png and tikz, scalingproblem [duplicate]

due to the huge amount of data in my plot I wasn't able to compile the whole badboy at once after creating a tikz file and then using latex. Since the save_size won't go higher than 80000. so while ...
7
votes
1answer
604 views

X-Bar plot with intervall (a,b) rather than (0,a)

When one makes a xbar plot using pgfplots, the bar always goes from 0 to the requested coordinate. For example (p. 78 in pgfplots manual): \documentclass{article} \usepackage{pgfplots} ...
6
votes
2answers
225 views

Splitting y domain in 3D pgfplots

What I want is to plot my function from y=0-->y=3 and then from y=3,2-->y=6. I want to ommit the space between 3 and 3,2. This is my code: \documentclass[border= 5mm]{standalone} ...
14
votes
2answers
388 views

quiver plot on hyperboloid surface

Using pgfplots, I'm trying to create a quiver plot on a hyperboloid surface something like this. I was able to generate the hyperboloid surface using parametric equations. I could'nt find out how ...
3
votes
0answers
69 views

Pgfplots fails to generate boxplots for some data set

I use pgfplots to generate boxplots, however with some small data sets as the following, I get an error message. speed 2 3 1 2 2 11 Here is the error message : Sorry, an ...
1
vote
0answers
149 views

PGFPlots - no lines between marks [closed]

I am starting playing with plots in latex. In my preample I have: \usepackage{pgfplots} \pgfplotsset{width=12cm,compat=1.9} My plots code: (first is copy from from tutorial, second is my attempt) ...
4
votes
0answers
135 views

Problems with pgfplots, loops inside tikzpicture and reading from files

I was trying to implement this method (How to import ASCII coordinates to TikZ) to import coordinates and draw them, but I am having this problem Undefined control sequence \end{tikzpicture} Extra }, ...
4
votes
1answer
112 views

Use column header as labels for x ticks

With pgfplots, it is possible to let the xticklabels be given by one column of a table. However, is it possible to import it from the table header ? In my concrete case, I have a table with two ...
4
votes
1answer
186 views

Draw lines inside tikz plot (exported from matlab), independent of coordinate system

I am exporting plots from matlab with the matlab2tikz package. While this works just fine, I now want to insert some lines and text to describe the plot. I have multiple plots which are to be labelled ...
5
votes
1answer
588 views

Plotting semilog plot with pgfplot

I am trying to graph frequency response of certain filters. This is the code I currently have: \begin{tikzpicture} \begin{semilogxaxis}[xlabel=Frequency, ylabel=Gain, xmin=1, xmax=20000, ymin=0, ...
7
votes
0answers
130 views

How to create vertical Bullet Graphs with PSTricks? [duplicate]

I was looking for a package to create bullet gauge graphs, but I couldn't find any. A good person in this forum show me how he would make it in TikZ, with a little options. I was waiting any moths ...
2
votes
0answers
305 views

LaTeX Box plot drawing using pgfplots

Two issues I have in the following code. I want to put the box in the middle of the line and I like to show the for the maximum value. Any suggestion will be appreciate. Thanks. ...
4
votes
2answers
179 views

Opposite command of “restrict y to domain”

How can I obtain the exact opposite of the command restrict y to domain? I have data in a table and I would like to color points inside [min:max] as black, and points outside [min,max] as red. I ...
6
votes
0answers
199 views

“Segmentation fault (core dumped)” with LuaLaTeX [closed]

I'm trying to compile a 3D surface made by 10000 data points with tickzpicture. However, when I compile the .tex file with lualatex lualatex --shell-escape myfile.tex I receive the following error: ...
15
votes
2answers
316 views

Is it possible to detect the “current color”? (for example in a pgfplot drawing?)

Is there a code to deduce the current color of a PGF plot to which a node is associated? Better yet, is it possible to get the RGB decomposition as well? ... addplot coordinates{ (0,0) (1,1) } node{ ...
3
votes
0answers
178 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 ...
0
votes
1answer
582 views

label font size in matlab->matlab2tikz

Does anyone knoy how can we increase the labels fontsize when we use the matlab2tikz (see this link) function from the mathworks file exchange? I always have to access the *.tikz generated file and ...
2
votes
2answers
141 views

Negative y value in polar plot

I'm having some trouble with polar plots. I have to plot negative values, but without changing direction. I tried to set the ymin value to be negative, but it doesn't work. ...
52
votes
6answers
2k views

Filling specified area by random dots in TikZ

I want to reproduce the following diagram in Tikz. LaTeX code of my MWE is below: \documentclass[tikz]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \draw [-latex, ...
6
votes
1answer
189 views

pgfplots: group stacked bars

I'm trying to create groups of 5 stacked xbars, using y expr={\thisrow{y} - (mod(\thisrow{y},5)/2)}. However, after some groups, the calculation seems to get thrown off and the third group actually ...
4
votes
1answer
92 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} ...
1
vote
0answers
189 views

How to adjust the inner and outer margin spaces around legend in PGFPlots?

How can I adjust the inner/out right/left/top/bottom margins of legend in PGFPlots? (not the space between the legend entries) e.g. indicated in the below figure.
5
votes
1answer
231 views

PGF Math: “An internal routine of the floating point unit near”

I am using this snippet: \documentclass{beamer} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ xlabel=$x$, ylabel={$f(x) = x^{-1}$} ] \addplot {x^{-1}}; ...
1
vote
0answers
37 views

Define styles to make series of similar pgfplots [duplicate]

I'm writing a journal paper, and in this paper, I have to produce many versions of the same graph as I look at the effect of varying different parameters on the variable of interest (in this case the ...
4
votes
0answers
179 views

How to draw this 3D H-layout recursive tree with Tikz? [closed]

Background: This is an extension problem from my last post How to draw the recursive H-Layout tree using Tikz?. The (2D) H-layout tree is actually from the VLSI layout problem in computer science. I ...
3
votes
1answer
223 views

Settting PGFplots axis environment options by means of \newcommand and {\newlength,\setlength}

Because I often use the same options for multiple axes in my LaTeX documents, I use the following code to simplify my life. \documentclass{article} \usepackage{pgfplots} ...
3
votes
0answers
386 views

PGFPlots: importing data from a txt file

So I imported data from two txt files. However, I would like to plot the mean of the data and then the standard deviation bars. How can this be done? \documentclass[tikz, convert = ...
17
votes
4answers
713 views

What is the best way to produce TikZ picture for discrete signals?

I would like to draw discrete signals, as shown in the illustration below, but not by way of drawings of individual lines.gnuplot could be used for this work? It would be nice to be able to choose the ...
9
votes
1answer
310 views

pgfplots: colorbar: align y ticklables to the right

I have a colorbar in pgfplots and would like to have the y tick labels aligned to the right. Using colorbar style={yticklabel style={align=right}} did not work for me. The left colorbar shows the ...
3
votes
2answers
133 views

How to expand a plot in a matrix over 2 or more matrix elements?

I use a matrix to arrange and align plots in a groupplot (as discussed here) and I want to create a groupplot with one subplot which have the size of for example two subplots as shown below. I ...