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.
9,698
questions
0
votes
0
answers
9
views
Dealing with 3D-plots: change the numeric range
It's the first time I've dealt with 3D plots. I would like to reproduce something that is as similar as possible to the one in the picture. Since I'm not very expert, I don't know the equation of the ...
1
vote
1
answer
25
views
pgfplots: only integer numbers and only ticks at integer places on the x-axis
I want to create xbar-diagrams like this, but I want to set
only integer numbers at the bottom x-axis (no 0.5, 1.5, 2.5, ...) and
only ticks at the places of integer numbers (no ticks at 0.5, 1.5, ...
2
votes
1
answer
31
views
customized marker (pgfdeclareplotmark) with color as argumeent
I am trying to customize the shape+color of a marker for a scatter plot. Everythink works when I hard-code the color (e.g. red):
\documentclass{article}
\usepackage{pgfplots}
\usepackage{xcolor}
\...
1
vote
1
answer
71
views
Function to take two points and return distance for use in node text
This code draws a triangle and labels each side with its length. Currently it uses a let-in expression to calculate the distance of each side. I'm unsatisfied with this as it would be better as a ...
4
votes
1
answer
141
views
dashed line in tikz
I have written the code for this figure, how can I add these two dashes to it
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,positioning,fit}
\usetikzlibrary{arrows,calc,positioning}...
3
votes
1
answer
72
views
How to draw this sort of diagram: Line plot with vertical error indicator
I want to plot this diagram in LaTeX:
I need ranges in x and y at the same time. I want to show Global Warming Impact (GWI) over Net Present Value (NPV) for different scenarios of both indicators. ...
0
votes
2
answers
37
views
customized legend marker created with tikzset
Example:
\documentclass{article}
\usepackage{pgfplots}
\usepackage{xcolor}
% Define TikZ styles for interpolation points and values
\newcommand{\interpolationPointStyle}{%
\tikzset{interpolation ...
0
votes
1
answer
40
views
Can't remove plot mark from 3d plot
I'm trying for the first time to do a 3 dimensional plot using pgfplots. I'd like to remove the blue marks in the graph but I can't understand how. This is my code:
\begin{figure}[H]
\centering
\begin{...
1
vote
1
answer
49
views
how can one plot an expression on pgfplots, which rounds a real number R to the nearest integer Z and computes a given series up to Z?
I have the following MWE:
\documentclass{article}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pgfplotsset{compat=newest}
\begin{figure}
\begin{tikzpicture}
\begin{axis}[%
xmin = 0, xmax = 1,
...
0
votes
1
answer
30
views
pgfplots: How to color inside a 2D polygon based on x and y values
I want to fill the inside of a polygon with a gradient of color. The color should vary from the lowest values of an expression (e.g., 5x + 6y) to the highest values of the same expression inside the ...
-4
votes
0
answers
85
views
arrowhead style
This is my code .I want the flash from the green car to come one centimeter from the end of the block instead of coming to the middle of the block, what should I do?
\documentclass[10pt,border=3mm]{...
2
votes
1
answer
89
views
pgfplots (xbar stacked): Small percentage values are getting overlapped
Problem: I want the the small values (<10% such as 10%, 7% and 6%) for N=12 and N=6 in the (a) and (b) bar-charts to be properly visible and not get overlapped with each other. I tried to change ...
3
votes
1
answer
68
views
Addplot messes with axis coordinate system?
I am trying to understand why the direction of the red arrow changes in the presence of the addplot line in the following example:
\documentclass[]{standalone}
\usepackage{tikz,pgfplots}
\pgfplotsset{...
3
votes
1
answer
614
views
pgfplots : md5 but no pdf
I'm re-opening some documents I worked on 3 years ago. Everything was working fine (set size, colors, text, legend, externalize to pdf, reinput pdf figure to save computation time)
I'm using exactly ...
0
votes
1
answer
46
views
Line plot colormap from table
I have a table of data with a meta column to define the colormap. Now what I want is that the color of the lineplot corresponds to the colorbar.
See the MWE:
\documentclass[tikz]{standalone}
\...
1
vote
1
answer
50
views
Fade out custom path
I am trying to fade out a custom path in an axis environment. So far, I am using the nfold library to create a new path with a defined offset and then fill the area between two neighboring paths.
Here ...
1
vote
2
answers
211
views
Can one generate a 'boxed polar plot' with pgfplots and polaraxis?
Sometimes data to be plotted on a polar plot take large values in a specific direction. Is it possible to shape a polar plot created with pgfplots and the polaraxis environment (for example via ...
0
votes
1
answer
66
views
pgfplots: `visualization depends on` works only when assigning a new macro name
Using a simplified version of an older answer as MWE:
\documentclass{article}
\usepackage{pgfplotstable}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}
...
0
votes
1
answer
11
views
To which entities can I anchor nodes in pgfplots?
I find it difficult to read from the pgfplots manual, which entities I can refer to, e.g. to anchor nodes with further information.
E.g. in the example below, what are some or all entities I can ...
1
vote
0
answers
51
views
Out of memory while compiling a simple pgfplots that reads a csv file
I have a csv file that stores pixel values of a 320x160 image. I'm trying to use tikz to create the figure in pdf but compilation fails with an exceed memory error. I don't want to try increase memory ...
2
votes
1
answer
143
views
Caption shifting vertically in groupplot
I am using a groupplot to create a discontinuity in the y-axis. However, when I'm applying the axis x line=top command, the caption shifts down, as shown in the screenshot attached.
Does anyone know ...
0
votes
2
answers
39
views
Weird issue with pgfplots legend deleting curly brace
When compiling the following
\documentclass{article}
\usepackage{amsmath}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=-1:1]
\...
2
votes
1
answer
662
views
Standalone tikz figure textwidth
I have a larger document from which I want to extract all tikz/pgfplots figures into standalone documents which I then include in my main document with \includegraphics. However, I usually set the ...
1
vote
2
answers
32
views
Rendering area between const plot and lines
I am encountering a bizarre rendering issue for this plot where the filled area appears to leave the area that it is bounded by.
Just wondering if anyone else is able to reproduce this error/suggest ...
5
votes
2
answers
233
views
How to boldface text inside sunburst chart and increase font size a little?
I have used the help of How to make a sunburst chart in Latex? and customized it to my need for creating sunburst chart. I need to boldface all the text inside it, and if possible, increase the size ...
0
votes
0
answers
14
views
Spy curve outside plotting range in a pgfplots' groupplot
I have a single point in a curve that is really outside the range I would like to plot, so I thought I would use the spy library to simply show the point. With the original range it looks fine:
But ...
1
vote
1
answer
39
views
format number in tikz plot
The following is an attempt to label an edge with the distance between two coordinates. If I exclude \pgfmathprintnumber from the node text, then I get a value of "120.57292pt", where as I ...
3
votes
1
answer
429
views
3D surface plot using Tikz, overlap
I am looking for hints or help on how to fix the following:
I am trying to get a nice-looking 3D surface plot of a parametrization of a part of a sphere. This is a MWE of it:
\documentclass[crop,tikz]{...
1
vote
0
answers
47
views
3D plotting with equations containing equal signs?
I have a few problems with 3D plotting, namely equations with equal signs in it. For example, x^2 + y^2 = 1 yields Package PGF Math Error: Unknown operator '=' or '=1'. Is there anyway around this ...
2
votes
1
answer
75
views
Draw a surface in a nonrectangular domain
I have the following code to draw a surface using tikz-3d:
\documentclass{standalone}
\usepackage{tikz,tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{75}{135}
\begin{tikzpicture}[...
4
votes
1
answer
67
views
Plot is being drawn on layer below gridlines
I'm having an issue with the order of layers in the second figure. In it, the lines and patterns for the plots are drawn on a lawyer below the gridlines.
Whereas the first figure's line and markers ...
1
vote
0
answers
43
views
Make all lines same length in Slope Field
In the following slope field, how do you get all the lines to be the same length?
\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{tikzpicture}
\begin{axis}[
...
1
vote
1
answer
25
views
rotate axis of tikzpicture to show bars in horizontal direction
Example:
\documentclass[10pt,border=3mm,tikz]{standalone}
\usepackage{pgfplots}
\definecolor{mycolor1}{rgb}{0.00000,0.44700,0.74100}%
%
\begin{document}
\begin{tikzpicture}
\begin{...
0
votes
1
answer
64
views
Color different regions of graph (tikz)
I would like to color the 6 different regions of a graph, delimited by curves, with different colors. It seems like I can only color one area at a time. This works to color one region:
\begin{...
0
votes
1
answer
127
views
pgfplots separate graph based on one column
I'm trying to automatically separate graphs in pgfplots. What I mean by this is something like this: IfI have s file like this as input:
x z y
1 4 1
2 5 1
3 0 2
4 10 2
Now I'd like to have the ...
0
votes
1
answer
47
views
Why last xtick of my PGFPlots graph is not showing?
I'm trying to draw a graph in Overleaf.
I'm using this template that I found online:
\begin{tikzpicture}
\begin{axis}[
title={C++ Threads performance},
xlabel={Number of particles},
ylabel=...
4
votes
2
answers
510
views
How do I keep the mantissa but get rid of the exponent in PGFPlots?
I am plotting the distance between the Earth and the Moon, and the lunation cycle for three years, 2018–2020 inclusive, and these distances are on the order of 10^5 km. Ideally, I'd like the exponent ...
0
votes
0
answers
32
views
How to build the 3d cartesian coordinate system like this and add this graph
When I used the pgfplots or tikz3d I have a problem that the x,y,z axis doesn't like this.
They always incline from it should be like the below image. How to set the x,y,z axis that x-axis is towards ...
1
vote
1
answer
41
views
Limit Grid to a specific area of the axis
in a graph which looks roughly like this,
\documentclass[]{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=...
0
votes
1
answer
36
views
Graphing simple 3d axis
How to draw 3d axis with component like this.
2
votes
1
answer
31
views
PGFPLOTS labels placement
I am trying to come up with a way to get the labels for my data points to not overlap.
I have been able to change the anchor or the alignment options of all the labels at once but I couldn't make it ...
1
vote
1
answer
63
views
The plot has the problem of lines getting collided with each other and not having proper formatting
\documentclass{article}
\usepackage{pgfplots}
\begin{document}
\begin{figure}[hbpt!]
\centering
\begin{tikzpicture}
\begin{axis}[
scale only axis=true,
width=0....
1
vote
2
answers
29
views
Problem when using cases environment in pgfplots legend
I noticed that if I use cases from package amsmath in a pgfplots legend, the legend box does not contain the whole text. See the MWE.
\documentclass{standalone}
\usepackage{amsmath}
\usepackage{...
1
vote
1
answer
72
views
Circle with a center mark and legend label in pgfplots
I'm trying to draw a circle in pgf plot with a + mark at its center. right now I have this code:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\...
1
vote
2
answers
368
views
Include folder with TikZ plots in the preamble
I'm writing my PhD thesis and I have just discovered the matlab2tikz script for MATLAB so I wanted to convert my plots and put them in the document using pgfplots. My thesis is already very big and ...
1
vote
1
answer
57
views
Resize LaTeX Histogram
I wrote this LaTeX code for generating a histogram. The problem that arises is that the histogram bars overlap and do not appear well defined as there are many coordinates in the graph, namely 1740. ...
1
vote
1
answer
275
views
Plotting cdf of a binomial distribution in tikz/pdfplot
I have been trying to plot the cdf (commulative density function) of a binomial distribution - in the easiest way possible (is there a package i could use?)
I would be glad if somebody already ...
0
votes
1
answer
45
views
Efficient "macro" for adding second (x-)axis to pgfplots
Lately, I have had to rely extensively on adding a second x-axis to my plots. I am doing so using the following script (see MWE), however, to me it seems quite inefficient and there's a lot of double ...
2
votes
2
answers
59
views
pgfplots: axis discontinuity moves entire plot to the right
Problem
I want to add an axis discontinuity on both my x and y axes, but doing so (even with just one axis) shifts my entire plot to the right.
MWE
Code
\documentclass[12pt, a4paper]{article}
% ...
2
votes
1
answer
51
views
Showing the Traces of a Hyperbolic Paraboloid
I'm having trouble getting the shading/layering for the traces of a hyperbolic paraboloid to look right. I tried breaking up the hyperbolic paraboloid and traces into sections and layered them ...