Skip to main content
Share Your Experience: Take the 2024 Developer Survey

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.

Filter by
Sorted by
Tagged with
4 votes
2 answers
196 views

How to draw such a diagram in Tikz with both positive and negative bars

How to draw such a diagram in Tikz in the easiest way? You can send a link to a similar example. MWE: \documentclass[tikz, border=2pt]{standalone} \usepackage[main=russian,english]{babel} \usepackage[...
Youra_P's user avatar
  • 1,096
1 vote
1 answer
25 views

pgf import in LaTeX not working due to matplotlib axes font

I was plotting as usual and then after saving one of my plots as a pgf and then compiling LaTeX it didn't work anymore. As far as I'm aware of, I didn't change anything it just so happen to top ...
L_physics's user avatar
0 votes
0 answers
13 views

shared legend position is not changed

\documentclass{article} % Standard package includes \usepackage{times} \usepackage{latexsym} % For proper rendering and hyphenation of words containing Latin characters (including in bib files) \...
O Y Jo's user avatar
  • 25
-1 votes
0 answers
45 views

how to create a figure with equation of runge kutti [closed]

I want to create the same figures that are shown on the page, and I want to know if the 28 numbers are page numbers or section numbers.
Abdel djalil Boulebbina's user avatar
3 votes
2 answers
100 views

plot a function in a subdomain with pgfplots

I'm trying to plot the function $-log(x^2+y^2)$ in a circular domain centered in (0,0). With addplot3 I can plot it on the square domain $[-1,1]^2$. With what I found here pgfplots and ifthenelse, I ...
Thomas's user avatar
  • 273
0 votes
1 answer
38 views

Formatting table with plots

Can someone help me format this table: I would like a little bit of space between the plots and the upper and lower margin of their respective cells. I dont know how to make the weaky relu function to ...
juan19.99's user avatar
1 vote
0 answers
57 views

Graph hardly readable - pgfplots options difficult

I am trying to create a plot representing the number of articles about resilience over a period of time. The data comes from a txt file, looking like this: Publication Years Record Count % of 141519 ...
Orsu's user avatar
  • 111
1 vote
2 answers
99 views

Measurement elements

Do you know how I can draw this and implement it in an electrical circuit?
Jose G Lopez's user avatar
4 votes
2 answers
76 views

pgfplot on closed interval doesn't reach endpoints

I'm editing a textbook that has many images (around 700) written using pgfplot. When the function being graphed has a square root, (or in general if the domain is a closed interval) I am running into ...
Sean Fitzpatrick's user avatar
2 votes
1 answer
74 views

Print macro in \addplot node label

I use a foreach loop to plot multiple curves via the \addplot command. The values that are necessary to define the relevant curve in each iteration are defined through some macros with the command \...
Laura Roich's user avatar
0 votes
0 answers
71 views

tikz colorbar with logarithmic scale

I would like to create a colorbar with tikz that matches the color scheme that I use in a figure that I import as a PDF file. The color scale should be logarithmic from 1e-6 to 1e-2. However, I only ...
BenjaminBluemchen's user avatar
1 vote
0 answers
31 views

MacOS Preview redaction tool breaks PGFPlots graphics

Using MacOS's built in file viewer Preview, I am attempting to redact information in a document built with LaTeX, containing graphs from PGFPlots. However, saving the file after using the redaction ...
Mingus's user avatar
  • 23
2 votes
1 answer
47 views

Rough edges on pgfplots contour

I am trying to make some filled contour plots using tikz and pgfplots. I am following the examples on the manual https://tikz.dev/pgfplots/reference-3dplots#sec-4.6.9. The manual shows the contour ...
durounseki's user avatar
1 vote
1 answer
22 views

Define tick labels in PGFPlots with a variable

When I try to specify ticks / tick labels in PGFPlots using a variable (for automatic report generation for example), it works for the ticks, but not for the tick labels. Here is the code I use: \def\...
Philippe's user avatar
1 vote
1 answer
40 views

Restrict domain of plots with data coming from different files

I would like to plot some data where the x axis values come from one file and the y axis values come from another file. However, I also want to restrict the domain of the plotted data. For example, ...
Meclassic's user avatar
  • 1,807
2 votes
1 answer
73 views

Recreating an animated diagram (stock price gains vs. time)

"Do-it-for-me" trigger warning! :) This question is based on a chat on this site between me and user cis, see here. I was wondering if it is feasible to recreate a type of animated diagram ...
Dr. Manuel Kuehner's user avatar
0 votes
2 answers
49 views

Fill Between Polar Graph Part 2

I have been looking for about 30 minutes and can't figure out how to shade the where area S is (both sides). I can fill the entire plot, but can't figure out how to use a soft clip to highlight the ...
Nick B's user avatar
  • 861
0 votes
1 answer
25 views

plot does not appar [closed]

to following code is part of my document \begin{figure}[h] \centering \begin{tikzpicture}[scale=0.9] \begin{axis}[tick label style={font=\scriptsize},axis on top, axis lines=center, xlabel=$x$,...
amanouss's user avatar
3 votes
1 answer
173 views

Tikz: Grouped Plot with Secondary y-axis

I have been working quite some time on a grouped error bar plot, but I've hit a wall: one of the variables (Variable 2) comes from a logistic regression, so its value/coefficient isn't directly ...
John's user avatar
  • 625
2 votes
1 answer
60 views

Fill Between on Polar Plot

I am trying to recreate a graph from the 2024 AP Daily Practice Session. I need to fill in the area of R and directly below it. I have tried FillBetween Command and Soft Clip, but I am just not able ...
Nick B's user avatar
  • 861
1 vote
1 answer
31 views

pgfplots plot difference between columns of table gives wrong results

This code compiles fine, but gives wrong results: \documentclass{article} \usepackage{pgfplots, pgfplotstable} \pgfplotsset{compat=newest} \begin{filecontents*}{data.csv} 1,2,5 2,4,6 3,5,8 4,7,10 5,8,...
Simon's user avatar
  • 325
0 votes
0 answers
51 views

TikZ meaning of "axis cs"?

The tikz code in https://tex.stackexchange.com/a/395177/13492 for drawing an epsilon-delta diagram illustrating the defintion of limit includes the following: \documentclass{standalone} \usepackage{...
murray's user avatar
  • 8,314
9 votes
2 answers
366 views

Curved beam on tikz

I am trying to reproduce the image below : I am not sure how to implement the « curvature » of the beam and adding the axis as a consequence of that is difficult. Can you help me? Thank you \...
Mario Topez's user avatar
4 votes
1 answer
38 views

How to cycle colors on different plots

I have a series of five stacked plots using groupplot, with each plot featuring a single curve. I would like to color each curve differently, but I've noticed that the cycle list schemes only apply to ...
Orestes Mas's user avatar
3 votes
1 answer
255 views
+50

How to draw cool 19th-century-style 3d plots?

I like making 3d parametric plots in tikzpicture, e.g. the one below. My question: is it possible to, instead of decorating the plot with a colour, decorate it with a pattern supported by tikzpicture ...
Pulcinella's user avatar
0 votes
0 answers
73 views

completely in red instead of shattered style

i want to mark the area under my graph. I want to have it hatched, but it is completely red. does anybody know how to fix it? thanks! \begin{tikzpicture} \begin{axis}[ width=\figurewidth, ...
Andre's user avatar
  • 1
2 votes
1 answer
43 views

Shifting the overlaping pgfplot axis labels

I'm struggling to find a way to make the plot look the same as source image. In it, on the x axis, the "close" (65,67 and 122,124) labels are shifted. I cannot force the pgfplot to do ...
jr.root.cs's user avatar
2 votes
1 answer
49 views

Fill area under curve points

So, I have this code and I need to fill area under curve points. How can I do that? a) First, I need to fill area under curve points from x = 1 to x = 5 b) I need to complete fill area. Thanks. \...
Pedro Salgado's user avatar
0 votes
1 answer
25 views

Using y right axis axis - tikz

I asked this before but somene said it needed clarification. Sorry for the oversight, I want to plot a stacked area. However, when trying to use the secondary y-axis, the "yticklabel" is not ...
Fernando's user avatar
  • 101
1 vote
1 answer
30 views

Plotted equations are halting at x=5 with PGFPlots

I am trying to plot two equations using PGFPlots. They are -(x-7)^2+12 and (x-6)^2-2. However, the resulting graph refuses to draw beyond x=5. I've looked over the code I am using to configure the ...
Mingus's user avatar
  • 23
1 vote
1 answer
32 views

Box plot graph - New line for long xticklabels

I want to make my "xticklabels" have a new line between them so that they are in two lines and not as cramped. The double backslash \\ and \n did not work. Code: \documentclass{standalone} \...
Erik's user avatar
  • 13
0 votes
0 answers
11 views

pgfplotstable: compute averages of columns

\documentclass{article} \usepackage{pgfplots} \usepackage{pgfplotstable} \pgfplotstableset{ create on use/mean/.style args={#1#2#3}{ create col/expr={(\thisrowno{#1} + \thisrowno{#2} + \...
Simon's user avatar
  • 325
0 votes
2 answers
39 views

Multi-colored and multi-bar grouped charts [duplicate]

I have a Python script that automatically generates LaTeX codes that plot bar charts. An example of the generated code looks like: \documentclass[border=10pt]{standalone} \usepackage{pgfplots} \...
Sirjon's user avatar
  • 111
0 votes
1 answer
20 views

pgfplot using second block of data separated by 2 blank rows

I want to use pgfplots in latex to plot data from a file that was formatted for use with index function of gnuplot. The data file has sets of x,y columns separated by two blank rows (gnuplot format). ...
csnl's user avatar
  • 1
1 vote
1 answer
37 views

Pgfplots \closedcycle not filled correctly

I am trying to illustrate a hull in a plot based on externally calculated hull nodes. For this, I use \closedcycle to fill the hull enclosed by the corresponding points. The first hull is plotted ...
albert's user avatar
  • 987
0 votes
1 answer
43 views

Missing part of curve

I have what I think is a simple plot of the normal distribution but for some reason the top of the plot is missing. I hope it's not because I got rid of the y-axis and ticks because I really don't ...
TonyK's user avatar
  • 647
2 votes
2 answers
114 views

pgfplotstable: Change to multicolumn row depending on input data

Let's say I have a huge amount of data rows structured in a simple .csv and these data rows could be divided in different data types. In the MWE I just added two types (typA & typB). In case the ...
PascalS's user avatar
  • 748
3 votes
1 answer
124 views

How to plot arcsin(sin(x)) with pgfplots in axis environment?

I would like to plot the function arcsin(sin(x)) within an axis environment using PGFplots. The behaviour I obtain leads me to believe that the functions arcsin and sin cancel each other before ...
Thomas Connor's user avatar
0 votes
1 answer
34 views

Putting labels below each bar in TikzPicture

I'm trying to create a graph like this: But I can only get it to look like this using legend text, but I want to put the text directly below the bar graphs (like 0ms, 50ms, 150ms) My code: \...
Erik's user avatar
  • 13
3 votes
1 answer
46 views

highlight a data point on a colormap

I am trying to highlight a data point on a colormap in a way to add a bigger circle mark at the coordinates (3.6,47). In this example (see the plot below) I just added additional point at this ...
Gagik's user avatar
  • 391
1 vote
1 answer
54 views

Highlight 3D plot minimum point

How can I display this plot in a different point of view, so I can highlight the minimum point? \documentclass[12pt]{article} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.11} \...
user3204810's user avatar
  • 1,489
0 votes
0 answers
22 views

How to remove axis border artefacts in pgfplots [duplicate]

My plot looks like this as you can see there are some odd grey arrowheads (top right corner of each subplot) on the borders of the plots. I have no idea what is creating them or how to remove them. ...
Astrid's user avatar
  • 341
4 votes
1 answer
79 views

How to define a custom axis attribute to reuse multiple axis settings?

edit: This post originally was named "Why is siunitx throwing an \endcsname inside newcommand?", but the rename does reflect the intention of the question better I think. Why is this code (...
VanC's user avatar
  • 57
2 votes
1 answer
50 views

Drawing one branch of hyperbola with asymptotes in tikz

I am trying to draw a single branch of hyperbola with tikz and I found in this forum a wonderful script here in this post (@DouglasMencken) : this post \documentclass[tikz, margin=10]{standalone} \...
Waxler's user avatar
  • 776
1 vote
1 answer
38 views

Extend linear regression over the whole plot

I have a set of data and I want to perform a linear regression on them and display the resulting line. Due to computational precision, the values reach a plateau after a certain point, and I don't ...
Thomas's user avatar
  • 273
1 vote
1 answer
47 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, ...
cis's user avatar
  • 8,266
2 votes
1 answer
43 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} \...
Simon's user avatar
  • 325
4 votes
1 answer
164 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}...
mzn's user avatar
  • 325
0 votes
2 answers
51 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 ...
Simon's user avatar
  • 325
3 votes
1 answer
91 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. ...
Fantastic MsFox's user avatar

1
2 3 4 5
195