# Questions tagged [pgfplots]

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

8,810 questions
Filter by
Sorted by
Tagged with
1 vote
20 views

### Vertical line from each plotted point on another line [duplicate]

I have a plot that looks like this: I want to achieve something like this in efficient way: As shown, I want vertical red bars or lines from each point on the straight line. My code: \documentclass[...
22 views

### pgfplots - Connecting max Values with new Line Curve

I need to create a plot showing a curve, which is connecting the peaks of other curves. Like the drawn black curve in the following picture: The other curves are created by the following formula and ...
13k views

### Differential Equation direction plot with pgfplots

In earlier thread Jake provided some code whom successfully draws the following differential equations in the range [0; 1] dy/dx=2*x dy/dx=x*sqrt(x) See: How to draw slope fields with all the ...
119 views

### TikZ-externalizing a PGF image (e.g. from matplotlib)

I am trying to include PGF figures from files (in my case created by matplotlib) and combine them with the TikZ-externalizing workflow. The benefit of including PGF figures in the first place is that ...
65 views

### missing a tick label that has been named

So I made this graph, and this graph can't show me the tick $\frac{5}{2}\pi$ at 7.85. I've tried to enlarge the x max range, give extra ticks (and extra tick label) but nothing works. Anyone can help ...
1 vote
44 views

### Overlap Circuitikz and Pgfplots figure

My problem today is to get to fit an electrical circuit (drawned using mainly \draw) into a Tikz Axis. I am using the Axis command to plot (using \addplot) a curve from a set of points (no problems so ...
1 vote
39 views

### Two graphs in the same axes \addplot3 (pgfplots) [closed]

I want to draw two graphs using pgfplots. Here's the first one: \begin{tikzpicture} \begin{axis}[ xmin=-pi, xmax=pi, ymin=-pi, ymax=pi, zmin=0, zmax=2.5, xlabel={\$\...
1 vote
54 views

### Draw the phase portrait

I am trying to make a phase portrait of two differential equations (second order) and the vector field of ODE. The equations are(I took the example from the following article): x'=x-4x^2+2y^2+10xy y'=...
1 vote
28 views

### Why aren't empty ticks working with empty plots?

I need to do an empty plot for my students to fill. Surprisingly the options xtick=\empty and ytick=\empty do not work when the plot is empty: \documentclass{standalone} \usepackage{pgfplots} \...
11k views

### Vertical line in ymode=log plot

Please have a look at the following MWE: \documentclass{article} \usepackage{pgfplots,pgfplotstable} \begin{document} \begin{tikzpicture} \begin{axis}[ %ymode=log, ] ...
96 views
+100

### PGFPlots possible keys

The general structure of a plot is: \begin{figure} \centering ...
1 vote
46 views

### Multiple pgfplots with common y-axis

As a part of manuscript, I have to plot multiple graphs whose x and y axes ranges are the same. I am using subflot along with tikzpicture. My question is, since the range of values of the both axes ...
44 views

### Draw contour on top of a discrerete heatmap

I have a discrete heatmap, and I would like to draw a contour plot to emphasize, for example, regions where z > 35. Do you have any suggestions on how to achieve this? The code I have for the ...
15 views

### PGFPlot scatter plot with custom legend

I have a scatter plot that shows three dimensions of a table. I don't want to use a 3D plot, so I represent the third dimension with the circle size. It looks like this: Here is the code: \...
98 views

### Pgfplots: Creating a bar chart

The figure below is a survey result from google docs. I'm trying to create a similar bar chart using LaTeX (overleaf) but so far I haven't been able to get the same results. The output figure aboce ...
1 vote
51 views

### Join graphs tikz + pgfplots

I have two graphics that I would like to join into one but even more I would like to put them inside text, something like this: \documentclass[12pt]{article} \usepackage{tikz} \usepackage{pgfplots} \...
79 views

### curve using tikz with a minimal example

\documentclass[tikz,border=13mm]{standalone} \usetikzlibrary{arrows.meta,decorations.markings,calc} \usepackage{pgfplots} \pgfplotsset{compat=1.16} \begin{document} \begin{tikzpicture}[>=stealth,...
1 vote
133 views

### How to draw a shaded boundary using TikZ

How can I draw a simple shaded region such as the one shown below using TikZ? The shaded region bounded by the equation r1r2r3 - r1 - r2 - r3 + 2cos(theta) and is r1=r2=r3=4. The boundary will ...
48 views

### pgfplots: shift the xlabel in the middle of the diagram

What do I have to set, to get the xlabel exactly in the middle of the diagram? \documentclass[]{book} \usepackage{pgfplots} \begin{document} \begin{tikzpicture}[font=\footnotesize] \begin{axis}[ ...
2k views

### Create 2x2 groupplot with +1 plot to the side?

I want to create a 2x2 + 1 plot like... ---------------------------| | Plot 1 | Plot 2 | | ------------------- Plot 5 | | Plot 3 | Plot 4 | | ---------------------------| How can I ...
2k views

### Phase Plane Plot using pst-ode

I am trying to incorporate the solution to the nonlinear differential equations x' = x + y + x^2 + y^2 y' = x - y - x^2 + y^2 The solution to these nonlinear differential equations were found with a ...
95 views

### Removing ticks from top, bottom and right-hand side of column chart and rename x-axis labels

I am trying to make a nice looking histogram of my data, and have managed to produce the following so far: \begin{tikzpicture} \centering \begin{axis}[ ymin=0, ymax=8000, minor y tick num = 2,...
113 views

### How to plot vector fields?

I would like to get this result (made with Python): But I get this result: This is my code: \begin{tikzpicture} \begin{axis}[ title={Campo de fuerzas}, width= 6cm, ...
769 views

### \pgfplotsset{compat=1.17} not working despite texlive newest version (2019.20200218-1)

My system is Ubuntu 20.04 and I am trying to compile a LaTeX file with newer tikz features \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.17} but it complains with ! Package pgfplots ...
112 views

### Minor ticks in log axis missing

I'm missing some minor y ticks in a logarithmic pgfplots axis: This has been generated with: \begin{tikzpicture} \begin{axis}[ ymode=log, ymax=31, ] \addplot[only marks] coordinates {(0,0....
29 views

### Figure referencing isn't working with PGFPlots

Here's my MWE: \documentclass{book} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \usepackage{subfig} \usepackage{titletoc} \begin{document} \begin{figure}[h!] \begin{center}{ \begin{...
12 views

### Setting y axis discontinuity at a certain value

I got the following diagram, that I want to make discontinous at a certain value, so that the "unneccessary" parts are skipped. I already tried adding an "axis y discontinuity", ...
1 vote
43 views

### Draw a piecewise constant graph from csv

I have the following csv file: 1,36 2,22 3,13 4,8 5,7 6,2 7,1 8,7 9,12 10,5 11,6 12,2 13,7 14,4 15,4 16,1 17,2 18,1 19,1 20,2 21,2 22,1 23,1 24,1 25,1 26,1 27,2 28,0 29,0 30,0 31,0 32,1 33,0 34,0 35,0 ...
1 vote
23 views

### PGFPlots washed out contour plots in some PDF viewers (addplot3)

I figured out, that only using Adobe Acrobat Reader I get a proper result for the code below. In other viewers, the result looks washed out, the colorbar has a wrong colorcode and the value of samples ...
109 views

### pgfplots - beamer reveals not working with "set layers"

I am creating a pgfplot in beamer where visual elements are revealed step-by-step. In particular, I have added extra tick marks which appear in a later frame, using the visible on style described here....
19 views

### Adding point over grouped bars - Latex

I am trying to add a blue point over the grouped bars. There is a way to achieve this? This is my latex code: \documentclass{article} \usepackage{pgfplots} \usepackage{filecontents} \begin{...
1 vote
80 views

### How to customize plot color using xcolor?

I am trying to plot multiple data sources on the same plot and differentiate between them with color. Here is a minimal environment for replicating the errors I am getting. \documentclass[a4paper,12pt,...
27 views

### Axis numbers overlapping. Any way to reduce the amount of ticks? [duplicate]

Just want to solve this problem, don't need any fancy solution for now, just reducing the amount of ticks should be enough, but couldn't get any close after looking for a while in the PGF manual. ...
99 views

### Dimension too large message when graphing hyperbolic tangent

I'm trying to graph hyperbolic tangent but I keep getting the message "Dimension too large" when the parameter "\A" gets too large like .6 or beyond. My code works fine for "\...
23 views

### Managing pgfplot labels [duplicate]

I am working with Pgfplot to plot some graphics, and I am having some trouble managing its labels. Specifically, I would like to know how to remove an automatically generated label. Let's take a look ...
28 views

### Is it possible to have a plot with ticks but without their numbers?

I want to save space when stacking many axes over each other. The plots have common domain, and I don't want to lose space for the same information repeated (the numbers on the x-axis). Is it possible ...
32 views

### Read data from different files for each frame (animateinline)

I wish to create a plot of data stored in different files and make an animation of it. But I am getting a Missing \endcsname inserted error. Since I'm using "non-text" components in a field ...
69 views

### Changing the color of a pgfplot within a command dynamically

I'm trying to change the color that is used for plotting dynamically while the plot function is embedded in a \newcommand. However I can't get it to show other colors than the last defined one. What ...
48 views

### How do I preserve grid lines while specifying x-ticks and y-ticks?

I've drawn the following plot: \begin{figure}[htpb] \centering \begin{tikzpicture} \begin{axis}[ domain=-3:5, smooth, axis x line=middle,...
65 views

### PGFPlot scatter plot with random color and legend

I want to draw a PGFplot where every point has a separate legend entry and a random color. So far I have just one legend entry and everything is black: \begin{tikzpicture} \pgfplotsset{ scale ...
22 views

### Pgfplots contour / axis on top = false

In spite of axis on top = false option, the 0 contour line in the following MWE, which is the x=0 equation line, doesn't appear. Any solution ? \documentclass[12pt]{article} \usepackage{tikz} \...
24 views

### pgfplots fails to display greek prefix when using unicode-math in LuaLaTeX/XeLaTeX

I'm experiencing difficulties trying to use the "Units in Labels" feature of pgfplots (pages 525-528 of the v1.17 manual). It works well in most circumstances except when the prefix is the ...
40 views

### Skipping some y values in ceiling graph

I am trying to plot a graph of ceil(3^x) for the domain 0:4. I can get the graph just fine. However, compared to the x values, the y range is very large and the jump marks are nearly tiny at higher ...
1 vote
27 views

### pgfplots: Position X-axis when drawing negative parabola

I've been wanting to draw a parabola using pgfplots resembling the image below. However, as I try to replicate this, the x-axis is always touching said parabola. Below is the code (\usepackage{tikz, ...
1 vote
30 views

### pgfplots: How do I manually change xtick labels (a letter instead of a number)?

The below picture is what I have currently: what I want is to change 4 to a and 6 to b; but, if I change one of them using the xticklabel option it globally changes all x-values to that value. There's ...
1 vote
29 views

### Something in my preamble breaks this tikz newcommand but only when used inside a foreach?

In a standalone document which I use to tinker with Tikz pictures before compiling in my main document as a way of saving compile time, I have used the following expression \documentclass[tikz,border=...
115 views

### How to plot Inverse of W-lambert function with pgfplots?

This is my effort for plotting w-lambert and its inverse, but I get an error: \begin{figure}[t] \centering \begin{subfigure}[scale = 1]{0.4\textwidth} % \...
28 views

### Bar chart drawing: lines getting mixed up and overlapping

I am trying to follow this example](https://tex.stackexchange.com/a/157028/122628) to draw a basic bar chart but the lines are getting mixed up. I think it's because major differences between the two ...
4k views

### Plot an elliptic curve in Latex

I am trying to plot the elliptic curve secp256k1 y^2=x^3+7 in my latex-document. \begin{center} \begin{tikzpicture}[domain=-4:4, samples at ={-1.769292354238631, -1.76, -1.74, ..., 2.26, 2.35, 2.7, 2....
1k views

### PGFPLOTS transposed legend with empty legend entries

I am having problems to correctly place the legend entries in a 3x3 shaped, transposed legend matrix with empty (skipped) entries for the following MWE: \documentclass{standalone} \usepackage{...