{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

2
votes
0answers
32 views

Control yticks using a mathematical formula

I am trying to define the yticks using a mathematical function of $ymin$ and $ymax$. Although the $y_{min}$ $y_{max}$ are known, I can't insert explicit values for yticks because I have to do this ...
3
votes
1answer
28 views

Show tick labels on both edgess in groupplot

I would like to put quite many small plots in a groupplot environment and provide ticklabels on all adges of the groupplot (no labels at individual plots). In the following example, I've set the ...
4
votes
1answer
46 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 ...
3
votes
1answer
34 views

filter pgfplots data more than once (e.g. with discard if)

I want to filter a dat file more than once (i.e., filter on multiple columns), and the usual solution with "discard if" and "discard if not" doesn't seem to work. I.e., the following (were file.dat ...
2
votes
1answer
31 views

pgfplots: minor tick num on one axis

I was just wondering if it was possible to use minor tick num on one axis only. \begin{axis}[ axis x line = bottom, axis y line = left, minor tick num=4, xlabel={$t(s)$}, xmin=0,xmax=5, ...
8
votes
1answer
1k views

How to read a specific portion of a data file in pgfplots

I have a data file which contains all the experiments that have been conducted for different cases. Is it possible in pgfplots to only read specific portion of the file and plot the results? Let's ...
5
votes
1answer
28 views

Discard values = 0 in pgfplots

In the code below, how do I go about removing all the enteries where the y1 AND y2 value = 0? Thanks for your help. Here is the original code that was masterfully written by Stefan Pinnow found ...
0
votes
1answer
49 views

Straight lines from x-axis to markers in pgfplots part 2

This post is building from the post found here that has an elegant solution proposed by JMP. I wanted to append just red markers to the existing plot so that the plot looks like: In summary, I ...
1
vote
2answers
49 views

Straight lines from x-axis to markers in pgfplots

I am trying to get a plot where there are just lines from the x-axis to the markers like this: Here is a MWE that I have so far: \documentclass{article} \usepackage{pgfplots} ...
2
votes
2answers
106 views

Using \tikzexternalize

I want to use tikzexternalize in my document, because the amount of tikz pictures is quite large. In general my tikz pictures are generated using matlab2tikz providing every tikz picture as a ...
2
votes
1answer
29 views

pgfplots: calculating intersections and drawing arrows to the axis with foreach

I am trying to find the intersection points between two curves and draw arrows from each of them to the x-axis. I tried the following code: \documentclass{article} \usepackage{pgfplots} ...
2
votes
1answer
29 views

Put pgfplots axis on the margin of printable text area

In order to gain some horizontal space (e.g. to put two plots next to each other) and because this is the least ugly solution for that I would like to be able to put the axis line of a pgfplot exactly ...
3
votes
0answers
43 views

“scale only axis” only for one axis?

EDIT: I completely rephrase the question. Consider the following MWE: \documentclass{article} \usepackage{showframe} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} ...
3
votes
1answer
44 views

Axis label positioning in pgfplots

Can someone please help me explain why label positioning in the following code does not work? It is not clear what I am doing wrong. I also tried axis description cs. That does not change the label ...
1
vote
0answers
32 views

reading inline table from macro

For a patch plot I need to read the patch table from a previously defined macro \mytable. However this results in an error: ! Package pgfplots Error: Sorry, the choice 'row sep=crcr' is currently ...
1
vote
0answers
46 views

Generating bar plot of sepearte colours

I am trying to plot a graph like below: Code that I have written already is: \begin{figure}[t] \begin{tikzpicture} \begin{axis}[ % symbolic x coords={$\tau =5$,$\tau = 10$,$\tau =15$,$\tau =20$, ...
2
votes
2answers
111 views

How Can I Decorate a Parametric Curve?

I'm trying to draw a special parametric curve, but my results are not good enough, because I'd like to decorate it. So, I've tried this: \documentclass[10pt]{article} \usepackage{pgf,tikz} ...
1
vote
0answers
35 views

Grouping data with pgfplots

Right now I have some data year,0-19 years,20-39 years,40-59 years,60-79 years,80-99 years,100 years+ 2015,100,100,100,100,100,100 ...
10
votes
1answer
108 views

Tufte like axis with pgfplots for log axis

I used the excellent code from TUGBoat issue 34 mentioned in this post Tufte like axis with pgfplots and was very happy until I tried to use it with logarithmic axis. The problem seems to be that the ...
2
votes
1answer
60 views

Plotting data series with pgfplots [duplicate]

I have a csv file index.dat with data Year,0-19 years,20-39 years,40-59 years,60-79 years,80-99 years,100 years+ 2000,100,100,100,100,100,100 2001,101,102,101,102,101,102 ... I am trying to plot ...
11
votes
1answer
230 views

foreach with colors leads to “undefined control sequence”

The following MWE works nicely when I remove the optional argument [\forcol] from the \addplotcommand or when I change it to red, for example. Though I would like the curves to have different colors ...
1
vote
1answer
54 views

PGFPlots xtick and ytick

I am having trouble working with xtick and ytick functionality within \pgfplotsset tag which I use for axis manipulation for all my tikzpicture tags for sketching graphs. I call this pair many times ...
5
votes
1answer
68 views

mark size dependent on y-value or variable

I want to make a scatter plot and vary the mark size dependent on a variable. Furthermore, I want the mark color to be dependent on the meta value given in a file (which works in the given code). As ...
3
votes
0answers
42 views

Is there a way to automatically force xticks on first and last data point in pgfplots?

I have created a custom pgfplot style which allows me to create line plots with the x axis being a time in hh:mm format. The data is loaded from .csv files. The automatic tick placement on the x axis ...
3
votes
1answer
25 views

Box on pgfplot with X-axis at origin?

I am doing a plot where I want the X-axis positioned at the origin, which is accomplished with the code below: \documentclass{article} \usepackage{pgfplots} \tikzset{>=latex} ...
5
votes
1answer
1k views

How to keep the same mark colour when using meta data for marker size?

Probably an easy answer to this, but I can't get it to work, and I obviously don't understand the manual or the other answers given to similar questions here on tex.sx (see 1,2, and 3). Basically I ...
2
votes
1answer
44 views

pgfplots: Scaling legend font size

There are a few posts that ask and answer how to scale the legend font size. For example, pgfplots: alignment and size of math in legend Resize font in legend below \tiny However, these rely upon ...
0
votes
1answer
71 views

How to display the y-values of each bar in pgfplots bar chart above the bar?

I am using code from this thread. link: Making one bar in a bar-graph stand out pgfplots Everything is working fine but I want to display the y-values of each bar in pgfplots bar chart above the bar. ...
3
votes
2answers
783 views

define manually the position of a pgfplots plot inside the TikZ picture

I just started using matlab2tikz for the graphics in my thesis and got stuck with a probably simple problem: I have a plot of a function and an inset (zoom-in) on it. Both the main plot and the inset ...
5
votes
2answers
86 views

combining absolute and relative coordinates for axis label

Consider the following MWE \documentclass{article} \usepackage{pgfplots} \pgfplotsset{ compat=1.12, stdaxis/.style={ ylabel style={at={(ticklabel cs:1.06)},anchor=west,rotate=270}, ...
2
votes
1answer
42 views

pgfplots other tick labels than symbolic coords

\documentclass{scrartcl} \usepackage{tikz} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ symbolic y coords={A}, ytick={A}, % I want to have B here ...
4
votes
0answers
45 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 ...
26
votes
1answer
7k views

pgfplots: prevent single plot from being listed in legend

In order to fill the area between two complex curves I use tables and the vertcat command (see Fill between two curves in pgfplots.). Now I don't want the plotted area to appear in my legend, just ...
2
votes
1answer
61 views

PGFPlots viridis colormap

I am trying to create a PGFPlots surf using the colormap viridis in a similar fashion as some examples of the PGFPlots package manual. I will get the error Package pgfkeys Error: I do not know ...
1
vote
1answer
37 views

How can I change font size on x-y labels

I have the following code which I copied from here How to draw the unit hyperbola in LaTex?, and rotated it. The axis labels font is too large. Going through the manual and deveral posts, am not able ...
1
vote
1answer
26 views

pgfplots filter table with float content and conditions

I want to filter some data for a plot, and so far the best thing I found is this here. This is the relevant code from the mentioned question: \pgfplotsset{ discard if not and smaller/.style n ...
1
vote
0answers
25 views

Fixing horizontal axis in pgfplots [duplicate]

I have the following plot and I would like to have the horizental axis fixed, but it scales and therefore I cannot see the details of the values between 0-50. To be more specific, in the horizental ...
2
votes
1answer
158 views

Positioning of named nodes and paths within groupplot environments

I am having issues with pgf, pgfplots and the groupplots library. The issue is best explained with an example \documentclass[tikz]{standalone} \usepackage{pgfplots} %\pgfplotsset{compat=1.12} ...
2
votes
1answer
116 views

I have 3 data series and 2 different y-axis. How can I add, outside the graph, the legend for each of three series?

Does someone know how can i change the position of my legend to right-side of my graph? I try many things but i can't. Please give me some help! Here is my code! \resizebox{\textwidth}{!}{ ...
5
votes
1answer
375 views

drawing lines using polar axis coordinate system in pgfplots

I would like to draw arrows with polar axis notation in a pgfplots figure that has Cartesian axes with the draw command: \draw[->] (polar axis cs:radius=1, angle=30) -- (polar axis cs:radius=2, ...
2
votes
0answers
49 views

I miss my ylabel in my latex pdf file

I draw the pic with tex, and I have included all the packages listed: \usepackage[perpage]{footmisc} \usepackage{graphicx} \usepackage{tabularx} \usepackage{paralist} ...
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
1answer
43 views

pgfplots: minor y ticks not showing

below code does does not draw y minor ticks. I could specify them manually, but would prefer to have them drawn automatically by 'minor y tick num=1'. Also I do not understand why exactly they are not ...
1
vote
0answers
42 views

Fill between curves in pgfplots for two plots side-by-side

In the following code I want to have the area between the curves filled in both plots. I tried the "fill between" package but when I apply it to both plots, the first one is not displayed. Any ideas ...
2
votes
1answer
54 views

Adding emphasis to a PGFPlots function

I have a function plotted with PGFPlots, and I'd like to add some emphasis to some maximum values and to some minimum ones, like the image below. How can I achieve that? (Sorry if duplicated, but my ...
3
votes
1answer
63 views

Exponential Function with “wrong” Plot in PGFPlots

While experimenting with PGFPlots, I found out a little weird issue: I want to plot the function given by f(x) = 2^x, so I type: \begin{tikzpicture} \begin{axis}[ axis x line = center, ...
2
votes
1answer
78 views

Why the `.tex` file is running indefinitely in PdfLaTeX?

I am using the following code to plot a set of graphs from the experimental data given in book1.txt. This .txt file is also kept in the same folder along with .tex. My book1.txt file is A B ...
6
votes
1answer
157 views

restricting variables in pgf plots

I am trying to draw the 'level curves' of the following function: where the variables are restricted such that x,y are non-negative, and x+y is less than or equal to one. In other words, this is a ...
2
votes
1answer
52 views

Non-uniform colormap

I am trying to use non-uniform colormap and I get this error: Package pgfplots Error: Sorry, non-uniform colormaps are only partially implemented, yet: the provided points must be multiples of the ...
2
votes
1answer
55 views

Placement of the scale tick label in pgfplots

My question on the placement of the scale tick label is related to Placement of scale tick labels in pgfplots. In contrast, I do not want to have the label placed behind the x-axis, but behind the ...