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.
10,133 questions
0
votes
0
answers
22
views
PGFPlots filled polygons with colormap
I want to plot a bunch of polygons and fill each of them with color from colormap. I am trying the following unsuccessfully:
\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=...
3
votes
2
answers
90
views
Single point in a figure on beamer
I'm trying to build a figure on beamer that has a single point on it. I've tried what I'd usually have done in other settings (article, book), but I'm still getting an error. In particular, I get
! ...
3
votes
3
answers
144
views
Thicker axis in PGFplot
Is there a better method to have the x=0 and y=0 axes thicker? I made a basic approach by adding lines, but is there a better method?
\documentclass{book}
\usepackage{pgfplots}
\pgfplotsset{compat=1....
6
votes
1
answer
166
views
Inaccurate TikZ/PGF plot
I'm using the following code to produce a plot:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width = 15cm,
...
7
votes
3
answers
254
views
help with 3D Surface plot TikZ
Can someone please help with coding the surface plot for
$\sqrt{(x - 1)^2 + y^2} + \sqrt{(x + 1)^2 + y^2} - 4 = -|z|$
in TikZ for my article in LateX? I have been trying, but can't seem to manage it. ...
6
votes
1
answer
114
views
Error linked to active characters?
This MWE gives an error that disappears if line #3 or line #4 are commented. I would say that this has probably something to do with active characters, but I am not able to understand what goes wrong ...
6
votes
3
answers
136
views
\tikzmath defined functions sometimes won't parse in \addplot, producing spurious errors
This is my first post so the graph may not appear and/or the format may look weird. Apologies if that is so.
The graph is produced when the line \addplot[red, thick] {myexp(x,4)}; is commented out
...
3
votes
1
answer
73
views
Why does PGFPlots separate the axes of my log-log graph?
I'm trying to make a log-log graph. Semi-log graphs and linear graphs work just fine, but for some reason when I try to make a log-log graph PGFPlots doesn't draw the horiziontal axis or the curve.
...
3
votes
1
answer
92
views
Aligning arrows along a path at fixed steps on a rectangular grid
The objective is to have arrows along a path for every 1-unit step we take horizontally or vertically. The arrows would be aligned midway between major grid tick marks, e.g. midway along (0,0)--(0,1). ...
3
votes
0
answers
45
views
Plotting quasi-3D figure with axial filled planes
I want to make a quasi-3D figure from three variables. They pair-wise form a two-dimensional figure. I want to emphasize that the green plot is in the green plane, etc.
I have two issues
1./ The red ...
5
votes
3
answers
208
views
Plot any real sequence of real variables as in Geogebra and Desmos
Several years ago, I created a GeoGebra script to plot any real sequence of real variables. As you can see from the screenshot, there is a command on the left:
Sequence({(n, 1/n)}, n, 1, M)
which ...
13
votes
5
answers
344
views
Iterated plot with TikZ, PGFPlots and foreach loop
I'm trying to plot an illustration of the fixed point method in which a function is evaluated repeatedly in a loop. The result should be a staircase or spiral plot on top of the plot of the function ...
3
votes
2
answers
111
views
Problem trying to set color in dynamic in pgfplot [duplicate]
I'm trying to draw 10 functions of ten different colors (actually starting from red and ending with yellow) inside a tikzpicture environment. Problem is that the code reads only the first color (red) ...
4
votes
2
answers
157
views
pgfplots: declare function and parameters globally
As I was intent on moving function declarations further up, so as to use them in multiple files, I noticed something unexpected. The first code plots a thin black line. The second code plots thick ...
3
votes
1
answer
97
views
Arrows along path are misaligned after unrelated calculations
The objective is to draw arrows that show convergence to a particular coordinate. The code below has served me well in simple cases. But attempting to use coordinates calculated with the intersections ...
5
votes
1
answer
138
views
PGFPlots Line Patch Plot with Decoration
Using tikz and PGFPlots, I am creating a patch plot from data table with the line patch type. I would like to decorate the end of each line with an arrow. What is the best way to do this?
Below is a ...
3
votes
1
answer
59
views
`tikzviolinplots` produces `! Dimension too large.`
%%% featues %%%
% violinplot
% CAVEAT: run it as `latexmk -pdf -shell-escape -interaction=nonstopmode -g main.tex`
%%% picture %%%
% https://tex.stackexchange.com/a/679168/222785
\documentclass{...
2
votes
2
answers
86
views
Loop over pgfplotstable rows and axis, or any other method
I would like to create a graphic that does what this file is doing,but without going through each individual line
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{...
4
votes
2
answers
159
views
Pgfplots -- Make units exactly 1 cm
I am trying to make a pgf plot so that when printed, the units are exactly 1 cm, i.e, the grid lines should be 1 cm apart. However, whatever I do, I cannot make it work and I really don't know why.
...
7
votes
1
answer
93
views
Undesirable slant in ylabel in pgfplots
I am trying to plot multiple curves, of which some are trigonometric, on the same plot. However, the ylabel appears to be slanted every time I use trig format=rad in my code. If I remove this, ...
0
votes
0
answers
76
views
How do I prevent "see-through" when overlaying a surf plot with a point cloud?
I am trying to create a surf plot with an additional point cloud on top. The data for both is saved in two different tables, which are then read and plottet into the same axis environment. Currently I ...
3
votes
3
answers
119
views
How to add extra y ticks to a pgfplots axis on the right with fixed width?
I have the plot of several functions on a single axis, and I would like to add extra y ticks on the right of the plot to show the different numbers to which these functions converge to. However, I can'...
8
votes
2
answers
262
views
Adding a colormap to a solution curve of a vector field
Here the curve is drawn with a single color (red)
It's easy to get the solution curve. The below figure is drawn in this app for y'=x^2+y^2-1, y(0)=1/2. As you can notice the color of the curve is ...
4
votes
1
answer
127
views
How to create tick labels on the outer bounds of the plot, not along the axes?
Need to add tick labels on the outside boundaries of the plot like on the pic below. Without axes explicitly displayed it works by default but after I add axes the labels are displayed inside the plot ...
5
votes
2
answers
188
views
Error when trying to graph logarithm function in a different base
I get this error when I try compile the function below
! Package PGF Math Error: Sorry, an internal routine of the floating point unit
got an ill-formatted floating point number `1Y6.9305e-1]'. The ...
5
votes
1
answer
91
views
barplot with worldflags as ylabels
I would like to make a very minimalist bar plot, with different color bar for each country and their respective flag (worldflag if possible) instead of name. I have tried a few different things, but ...
13
votes
4
answers
656
views
Plotting functions without sampling artefacts
I am interested in a generic technique to visualize functions in a quality appropriate for journal articles.
Consider the function $$-\sqrt{\lvert x-\tan y \rvert}$$ over $[0,1]^2$. Tools like ...
5
votes
3
answers
245
views
TikZ: Swapping axes in a three-dimensional coordinate system
I would like to create the following coordinate system with TikZ. German school books seem to deviate from (international?) conventions here; in any case, the axes need to be swapped, among other ...
11
votes
2
answers
927
views
Why is my Student's t-distribution plotting incorrectly in pgfplots?
I am trying to plot a Student's t distribution without using gnuplot. Here is what I have been trying:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\...
2
votes
1
answer
69
views
Error with pgfplots and gnuplots on Mac TeXShop
I am trying to compile a document using pgfplots and gnuplot. The relevant code block that I am trying to compile is:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{...
-1
votes
1
answer
127
views
Type gradient math text
how can I generate a math-text using gradient coloring, like this?
3
votes
1
answer
87
views
How to scale down a TikZ/PGFPlots figure with matching font size and good PNG quality
I am trying to export a small TikZ/PGFPlots figure as a PNG using the standalone class with the convert option.
My goal is to make the overall figure smaller (so that both the plot and the font size ...
3
votes
1
answer
115
views
3D plot "hide axis" produces spurious space
Setup
I'm following the answer about parameterized curves in a sphere from https://tex.stackexchange.com/a/199715/7561. I'm inserting these spheres in a bigger diagram and noticed the extra space ...
4
votes
3
answers
231
views
Highlight a range of y-values in a pgfplot dateplot
I have a set of values that I am plotting with the dateplot library of
pgfplots.
But I also need to indicate the desired range within which those
values ideally should lie in.
How can we highlight ...
6
votes
2
answers
194
views
pgfpolar-plot is shifted right
The plot is shifted to the right -- it should be centered. Any ideas why? I assume it comes from my coordinate transformation, since I plot nothing, the coordinate system is centered.
\documentclass{...
-1
votes
2
answers
97
views
Adding a point at the end of a graph and labeling the function [duplicate]
I am trying to add a black circle to the next picture at (-1,0), to indicate that the graph starts there. I tried using \filldraw[black] (-1,0) circle (2pt) but it did not work. Also, how can I add a ...
2
votes
2
answers
104
views
Viewing angles in pgfplot's axis
I am starting to work with pgfplots and I'm struggling to get my axes right. I know that choosing the two angles in the view={}{} option of the axis environment can change the setup of your axes. ...
10
votes
1
answer
368
views
Memorizing inconsistent key names in pgfplots
I absolutely love tikz and pgfplots, and I am really thankful for what their authors have built. I regularly am surprised and in awe by what people can accomplish in them. Also, both of them have ...
0
votes
1
answer
81
views
Pgfplot Heatmap building fails due to ```\pgfmath@dimen@ ...men@@ #1=0.0pt\relax \pgfmath@```
I want to plot a heat map of our earth (it's actually SNR of HF-Propagation). This works fine, however, if enable the colorbar in my axis definition I run into this issue:
! Undefined control sequence....
4
votes
1
answer
144
views
PGFPlots and the gradient of a function
Tonight, I discovered that pgfplots can generate automatic vortices (gradient), i.e., level curves, using the contour lua= option when compiling with LuaLaTeX. I made some modifications to the code ...
4
votes
1
answer
114
views
Wrong axis label position in PGFPlots with extra ticks
I noticed an issue with the placement of axis labels in PGFPlots when all of the following conditions are met:
tick align=center or tick align=outside is used (not with tick align=inside),
there is ...
4
votes
1
answer
75
views
Change point according to shapes and colours independently from csv table
I am trying to make a scatter (in a group plot) with data taken from a reference csv file. The x values are in the column PC1, y values are in the column PC2. I wanted the mark / shape to change ...
2
votes
3
answers
187
views
How to make the font of standalone graphics with pgfplots the same as the beamertheme in use such as moloch or metropolis
I would like to achieve font consistency between graphics created using the standalone class and those rendered directly in Beamer using the metropolis or moloch themes.
I'm creating plots with ...
6
votes
1
answer
190
views
Managing vortex and spiral behavior in PGFPlots
I am trying to draw a vector field in pgfplots, but I am encountering issues that I can't solve despite various attempts.
Specifically, I want the vortices or spirals to be dependent by the vector ...
1
vote
1
answer
104
views
I want to put the image in place of the logo written above In this poster
I want to put the image in place of the logo and the name of the university that is in poster
\documentclass[20pt,margin=1in,innermargin=-4.5in,blockverticalspace=-0.25in]{tikzposter}
\geometry{...
4
votes
2
answers
158
views
pgfplots: yticklabel positioning in partial polar plot
I'm drawing polar plots covering only half of the full 360° (the right half of the circle) using pgfplots, and I can't figure out how to shift yticklabels to the top part of the plot (+90° in the plot ...
1
vote
2
answers
77
views
Size of chemical formulas on a chart
I need to add equations to some parts of the curves: I'm using the chemmacros package.
I'm having trouble because the size of the chemical formulas seems too large compared to the curves: I therefore ...
6
votes
3
answers
340
views
Mathematical path or approximation for a curly brace usable in 3D projective diagrams
I’m not sure if this is the best approach, but I’ve been trying to create a curly brace using an explicit mathematical function.
So far, I’ve combined a couple of curves to approximate the shape, but ...
1
vote
1
answer
76
views
Proper display of markers in legend of ternary plot when using area style in pgfplots?
I'm trying to combine patches and individual marker symbols in a ternary diagram, but not able to display the markers in the legend. The following is my attempt with two different ways of adding ...
0
votes
0
answers
61
views
How do I position the y-labels?
I want to position my y-labels such that the plot doesn't cover up the label.
This is the code that I used:
\begin{tikzpicture}[>=latex]
\begin{axis}[
axis x line=center,
axis y line=center,...