2022 Developer Survey is open! Take 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
1 vote
1 answer
23 views

PGFplots/groupplots/tikz use whichever is lower: xmin or data

I'm making a lot of plots with pgfplots/groupplots/tikz from csv files, using \addplot[...] table[...]{file.csv} or \nextgroupplot[...] table[...]{file.csv} Some files have both positive and negative ...
user avatar
  • 111
0 votes
0 answers
16 views

Create Pgfplot from long data table with multiindex

I want to use Pgfplot to plot the csv-data in the following form: The Problem is, that the Data is saved with a multiindex. So in the end the x-axis shall show the Steps, and the y-axis the Preis_kwh ...
user avatar
  • 1
1 vote
0 answers
35 views

Use "each nth point" with \addplot3

I would like to use each nth point in combination with \addplot3 to plot every tenth data-point for both the x-axis and y-axis, but whatever I try, pgfplots just ignores it and uses all the data ...
user avatar
4 votes
2 answers
391 views

Most common command to compile a LaTeX document?

I am not sure if the question makes sense; this is my attempt. I am writing a program that generates a String that is valid LaTeX and compiles it. It will generate a PDF for my users. In my computer I ...
user avatar
0 votes
1 answer
34 views

Misplacement of x in a bar chart with legend

I recently started using latex for my bachelor thesis and I am unable to resolve the misplacement of the symbolic x coords. Also I would like to have a consistent spacing between the different bars. I ...
user avatar
1 vote
1 answer
22 views

Node in three dimensions with pgfplots

I am using pgfplots to draw a curve in three dimensions. I've placed a point on this curve, and would now like to obtain the following two: The node's name should appear below the node; I would like ...
user avatar
  • 159
1 vote
1 answer
26 views

Minipage Text and Figure Alignment

I am trying to align some text and a figure (pgfplots) together. I looked through some threads and found a nice package adjustbox which aligned the text and figure. However, by my example, the text ...
user avatar
  • 396
0 votes
0 answers
37 views

pgf plot stacked bar graph random colors

I created this graph, but the colors are repeating since there are a lot of them. Is there a way to randomly generate colors for the bars? Here's the overleaf doc: https://www.overleaf.com/read/...
user avatar
1 vote
1 answer
27 views

Pgfplots bar plot

I am trying to display on horizontal bar plot numeric data however when i try to add string labels instead of numbers on y axis it do not work - What am I doing wrong? code \documentclass{minimal} \...
user avatar
0 votes
1 answer
32 views

pgfplots, ybar stacked, node near coords using texts instead of values

I created this graph, but in the colored areas, I want to put the legend text instead of the coordinate value, e.g. for the first blue bar, it should be "head" instead of "21.6". ...
user avatar
0 votes
2 answers
29 views

Arrow between two graphics

I have two charts and I would like to place an arrow as shown in the figure: I am using pgfplots for the graphics, in fact this is the code: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{...
user avatar
  • 195
0 votes
1 answer
35 views

Best way to automatically set tick precision in pgfplots?

I know that I can manually set precisions like so: x tick label style = {/pgf/number format/fixed, /pgf/number format/fixed zerofill, /pgf/number format/precision = 2}, y tick label style = {/pgf/...
user avatar
0 votes
0 answers
15 views

pgfplots: legend from column

In the following example, how can I use the column label as source for a legend? \documentclass{article} \usepackage[a4paper, left =2cm, top = 2cm, right = 2cm, bottom = 2cm]{geometry} \usepackage[...
user avatar
1 vote
0 answers
28 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[...
user avatar
  • 1,177
0 votes
0 answers
31 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 ...
user avatar
8 votes
2 answers
302 views

Drawing the phase portrait of two differential equations

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'=...
user avatar
  • 321
1 vote
1 answer
31 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} \...
user avatar
  • 1,056
0 votes
1 answer
131 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 ...
user avatar
1 vote
1 answer
49 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={$\...
user avatar
0 votes
0 answers
16 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: \...
user avatar
2 votes
1 answer
46 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 ...
user avatar
1 vote
1 answer
57 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 ...
user avatar
  • 101
1 vote
1 answer
52 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} \...
user avatar
  • 321
2 votes
1 answer
51 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}[ ...
user avatar
  • 6,217
2 votes
2 answers
102 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 ...
user avatar
  • 23
0 votes
1 answer
80 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,...
user avatar
1 vote
1 answer
153 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 ...
user avatar
  • 1,696
0 votes
2 answers
31 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{...
user avatar
  • 182
0 votes
0 answers
15 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", ...
user avatar
1 vote
0 answers
25 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 ...
user avatar
  • 11
4 votes
1 answer
139 views

PGFPlots possible keys

The general structure of a plot is: \begin{figure} \centering ...
user avatar
1 vote
1 answer
45 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 ...
user avatar
  • 625
3 votes
0 answers
115 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....
user avatar
  • 2,410
0 votes
0 answers
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{...
user avatar
1 vote
1 answer
81 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,...
user avatar
  • 121
0 votes
2 answers
28 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. ...
user avatar
0 votes
1 answer
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 ...
user avatar
0 votes
1 answer
29 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 ...
user avatar
  • 213
0 votes
2 answers
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 ...
user avatar
0 votes
1 answer
49 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,...
user avatar
0 votes
1 answer
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} \...
user avatar
  • 165
0 votes
2 answers
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 ...
user avatar
1 vote
1 answer
28 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, ...
user avatar
0 votes
1 answer
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 ...
user avatar
  • 1,177
1 vote
1 answer
31 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 ...
user avatar
1 vote
0 answers
31 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=...
user avatar
0 votes
2 answers
66 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 ...
user avatar
0 votes
1 answer
29 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 ...
user avatar
  • 499
2 votes
0 answers
63 views

Using pgfplotspointgetcoordinates together with fillbetween command

I'm curios with following strange behavior of my code (see MNWE below). If the command for filling area between function is added, than the coordinates A and B are changed. It is weird for me, because ...
user avatar
  • 3,516
0 votes
1 answer
49 views

Grouped vertical bar chart from CSV

I have the following .csv file, percentages.csv: prefetcher,trace,ipc,ipc-per-diff gcc,ampm-lite,0.339157,0.164172 gcc,ghb-pc-dc,0.306047,0.050520 gcc,ip-stride,0.308053,0.057406 gcc,next-line,0....
user avatar
  • 488

1
2 3 4 5
177