{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

3
votes
1answer
150 views

How to remove all of ticks keeping the extra ticks

I want something like \begin{axis}[ y ticks=\empty, extra y ticks={-1,1}, extra y tick style={yticklabels={{name1},{name2}} ] ... \end{axis}
2
votes
2answers
2k views

pgfplots: How to place the legend box in the middle of an axis

I would like to have something like legend pos= west, %insted of north west, south east... because I don't wanna place it in the corner but vertically in the middle. How could I do this?
2
votes
1answer
1k views

pgfplots: How to specify custom tick and label at specified value on an axis

I would like to specify a custom tick with a custom label at a sp \begin{axis}[ symbolic y coords={<{Critical point} at 2.138 ???>}, ] \addplot+[samples=100,domain=-2:2] {x^2}; ...
5
votes
1answer
259 views

How to use a macro inside tick definition in pgfplots

Consider the following code: \documentclass[border=2pt]{standalone} \usepackage{pgfplots} \newcommand\myxtick[1]{\foreach \x in {2,3,4}{\x,}#1} \newcommand\otherxtick{2,3,4,5} \begin{document} ...
3
votes
1answer
307 views

addplot data frame

Square one: I have about 8 hours of experience. I want to make a barplot in pgfplots and see many great, creative solutions on this blog. All I want at this stage is not to specify coordinates and not ...
5
votes
1answer
356 views

How can I make dateplot x-ticks steps to 4 years?

I'm currently trying to create a nice election diagram for Bavaria. This is what I got by now: LaTeX source Complete source with Makefile and data is on Github. Here is the LaTeX-part without ...
7
votes
1answer
901 views

Skipping or changing one grid line

I'm trying to plot normalized data in a bar chart. To better show that the data is normalized, I want the horizontal grid line at 1 to look differently, eg. dashed instead of dotted. I guess this can ...
4
votes
1answer
462 views

Have gnuplot inherit the domain from pgfplots

I'm using domain=min:max within pgfplots, but unless I provide the same limits to gnuplot explicitly, they are ignored and gnuplot proceeds with plotting in the range [-10,10] (I assume that is the ...
2
votes
1answer
309 views

Softsign derivative 1/(1+abs(x))^2 not drawn correctly at the 2009 latexlive version tikz, pgfplots

I want to draw 1/(1+abs(x))^2 in tikz. At home I have the new latexlive version installed and everything looks fine. At work I do not have the new latex version because Ubuntu 12.04 still includes the ...
6
votes
3answers
1k views

Plot function with 2 variables in tikz / pgfplots

Using Tikz / pgfplots, how can you plot a function with two variables, such as: |x| + |y| <= 1 / sqrt(2)? If the function only had one input,X, it is easy to plot: \begin{figure}[!hb] \centering ...
7
votes
1answer
1k views

Automatically adjust ybar width (overlapping bar plot)

I am plotting a table with vertical bars and I get in trouble for large tables since the vertical bars are overlapping. Is there an option to automatically adjust the bar width? Here is the code ...
4
votes
1answer
153 views

Range chart by category and value

Basically I've been writing my work with XeLaTeX enthusiastically now for about a year and love it, but today for the first time I tried to draw a graph and realised I still have a lot to learn. ...
3
votes
0answers
70 views

Real Zoom in a plot [duplicate]

I was wondering if there are a mean to zoom in the plot, I know about spy library (PGFPlots) but this later tries only to scale the windowed area and get the raster bitmap after a stretch. Here, I am ...
2
votes
1answer
116 views

Special design of 3 plots with LaTeX

I wish design 3 plots (A, B and C) in the form of: ------------------------+---------------+ | | A | | ...
7
votes
1answer
171 views

Pgfplots and confidential data

I have a table which contains confidential informations but there is no problem to publish the boxplot resulting of the table. To produce the boxplot, I am using pfgplot, which reads directly the ...
2
votes
1answer
1k views

pgfplots: multiple legends or one legend and a heading

In my plot, I want my standard legend that says what value of c corresponds to what color. However, I would also look to put the function in plot. \documentclass[tikz]{standalone} ...
7
votes
1answer
530 views

pgfplots: 2d graphics in 3d axis environment

I would like to stack several external 2d plots into a 3d axis environment like the orange and green planes in my example. As the 2d plots are created externally, I am looking for a way to rotate and ...
6
votes
1answer
2k views

Graph of sin(1/x) in pgfplots and TikZ

I try to draw the graph of sin(1/x) on domain (0,1]; using pgfplots, it seems to work, but with TikZ plot-function, it doesn't. What am I doing wrong? My code: \documentclass{standalone} ...
5
votes
1answer
210 views

How Can I Format My Tikz Figure Correctly?

I am having problems formatting my picture correctly. There are three graphs here. I'd like the first two to be side by side and the third to be under them. With what I've got the first two ...
14
votes
1answer
247 views

Let ymin be at most 0

I would like to make a graph of some points, where ymin is at most 0. By default, ymin is the value of the lowest point in the graph. I would like to let ymin be the value of the lowest point or 0 if ...
13
votes
1answer
4k views

Having y-axis in log scale base 2 using pgfplots

I have made a chart using pgfplots as written below and I want to have the y-axis in logarithmic scale. This code works fine but the base of the logarithm is 10. How can I change it to base 2? ...
5
votes
2answers
509 views

Color legend in Y axis

I have the following multiple y-axis plot that results in the image on the top image. However, I want to add a sort of legend in each of the Y axis, similar to what I manually drew in the bottom ...
5
votes
1answer
353 views

Line style not updated when using gnuplot within pgfplots

I have a large data file with multiple columns. This makes it impossible for me to add multiple \addplot commands manually, so I am using gnuplot from within pgfplots. The problem is that gnuplot does ...
4
votes
1answer
464 views

Plotting a Function in pgfplots with a Gap in the Domain

I recently received help plotting the function here. I would now like to remove a portion of the graph. I want to remove the part with -2<= x <= 1. When I comment it out, pgfplots fills in ...
10
votes
1answer
3k views

Piecewise Function Using Pgfplots

Using the question here I have tried to plot a piecewise function. My code looks like \begin{document} \pgfmathdeclarefunction{func}{1}{% \pgfmathparse{% (and(#1<=-2) * (#1*#1 + #1*6 + 8) ...
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 } ...
1
vote
1answer
239 views

Using a macro inside the axis options for pgfplots

I want to create an macro to replace the string '{a,b,c}' in my code: xticklabels={a,b,c} so I set \newcommand\inputnames{a,b,c} xticklabels=\inputnames but this gives me the same result as ...
5
votes
1answer
512 views

Color of bar plot depending on the bar height (pgfplot)

Does there exist any command to make the bar color depend on the bar size ? For example, the color of a bar of size x (between 0 and 100) should be filled of x percent of black, as displayed below. ...
1
vote
1answer
456 views

Only the old version of pgfplots is available with MiKTeX (version 1.7)

I am looking for a solution to install the last version (currently 1.8) of pgfplots via the package manager MiKTeX on Windows. However, MiKTeX only offers the old version 1.7 of pgfplots. Is there a ...
5
votes
1answer
362 views

Significant figures with pgfplots

Is there a possibility with pgfplots to print numbers with no decimals for the nodes? By this, I mean printing '2' instead of '2.0e0'. In my case, I want to remove the decimal part and add the ...
2
votes
1answer
731 views

Adding a legend next to subfigures of pgfplots

I have an error bar chart, where I would like to add a legend. Using this type of code, I am facing problems to add any kind of legend. Please consider my current code: ...
2
votes
0answers
59 views

TikZ external Library and pgfplots reading data from external txt file [duplicate]

I'm using the external library of TikZ for speeding up the compilation of my LaTeX document. In another thread, Christian Feuersänger reported that from December 2012, the external library uses MD5 ...
10
votes
1answer
533 views

in PGFPlots, use meta data for markers?

Is there (I'm sure there must be) a way to use meta data for markers? I have something like the below: Year coeff meta 2005 1.2183 o 2006 ...
5
votes
1answer
306 views

Avoiding warning message with “each nth point” option in pgfplots

Let assume I have a signal with a very large number points. Once I obtain the associated TikZ file, I may run out of memory for compilation... Ok, so one way to solve this issue is to use the option ...
6
votes
1answer
479 views

pgfplots: changing dashed line dash locations

Is it possible to have one set of dashed lines fill the gap of another set? The black is just barely sticks out from the purple. I would like the black to fill the gap in the purple. ...
2
votes
1answer
995 views

pgfplots: using pi in foreach

How can I use pi the number in a \foreach in pgfplots? \documentclass[tikz, dvipsnames]{standalone} \usepackage{pgfplots} \usepackage{mathtools} \pgfplotsset{compat = 1.8} \begin{document} ...
0
votes
0answers
61 views

pgfplots: undefined control secquence in a foreach loop [duplicate]

I am getting an undefined control sequence when using \col in a \foreach loop. ! Undefined control sequence. \pgfkeyscurrentkey ->\col \documentclass[tikz, dvipsnames]{standalone} ...
7
votes
1answer
2k views

Alignment of subplots in pgfplots

I would like to align a larger figure with two smaller subplots that should be of the same size and reach to the below south east and below south west anchors of the main figure. The example below ...
6
votes
1answer
430 views

pgfplots - How can I achieve an xbar plot with bars adding up to 100% on both ends?

edit I don't need a solution anymore, I decided to not use the "negative" bars on the right side but I am leaving (and not deleting) this question in case someone else is looking for this in the ...
3
votes
1answer
78 views

How to put legend graphic representation to the right of the label

All the pgfplots examples I could find have the graphic (e.g. symbol) to the left of the label (see example below) in the legend. I think this default is very good but due to space constrains I have ...
3
votes
1answer
848 views

Plot with Min/Max bar and two average points

I am trying to stop using Excel charts in my academic papers and rather use something more LaTeX integrated such as Tikz. My current Excel chart looks like that: As can be seen, any combination from ...
7
votes
1answer
879 views

Common label for a groupplot [duplicate]

This can be considered a combination of the following questions How can a title be placed for a group of pgfplots? Align ylabels of grouped plots at a common line The following piece of code ...
10
votes
1answer
1k views

Recreate plot when data file changes

Is it possible to use the TikZ/external library and have pgfplots recreate a figure when a data file that is plotted changes? Say I have something like the following: file.tex: ...
3
votes
0answers
740 views

Clustered Stacked bar Chart Overlapping Labels

I have following code by which I generate the following graph \documentclass{article} \usepackage{pgfplots} \usepackage{tikz} \usepackage{xcolor} \usetikzlibrary{arrows,automata,calc,shapes, ...
5
votes
1answer
2k views

How to set Tikz scatter marker weight?

I'm using tikz to produce scatter plots as shown in this question. I can define the marker size with \tikzset{mark size=8} but now I'm looking for a way to make the line of the marker thicker in a ...
4
votes
1answer
442 views

How can we only plot grid in X direction?

How can we only plot grid in X direction? Could we change "grid=both" to "grid=..."? \begin{tikzpicture}[scale=0.8] \begin{axis}[ grid=both, domain=0:2*pi, samples=200, no marks, ...
5
votes
1answer
137 views

Why do I have two different styles for my bar plots?

I have two bar plots—one uses error bars and draws its data from a table, the other does not. As far as I can tell, this is the only difference between the two. Why are they displayed in different ...
0
votes
0answers
28 views

How to install pgfplots in Ubuntu 12.04.3 LTS? [duplicate]

How to install pgfplots in Ubuntu 12.04.3 LTS from Terminal? I have the following: a@a-Compaq-Presario-C700-Notebook-PC:~$ pdflatex --version pdfTeX 3.1415926-1.40.10-2.2 (TeX Live 2009/Debian) ...
5
votes
1answer
1k views

pgfplots: Changing horizontal spacing in the legend [duplicate]

I'm drawing a simple scatter plot with pgfplots, which also includes a legend as shown in the upper part of the picture next. However, I find the horizontal spacing odd because the distance between ...
3
votes
3answers
2k views

TikZ exits with “do not know the key '/tikz/restrict y to domain”

When I try to compile, I get the following error. Runaway argument? samples=60, domain=0:10, xmax=10.5, restrict y to domain=0:10, axis l\ETC. ! Paragraph ended before \pgfplots@@environment@axis ...