Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

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.

2
votes
1answer
19 views

Dropping a line from a categorical point in a pgfplot scatter plot

This is a scatter plot, where x-axis is categorical and y-axis is numerical. I want to draw a perpendicular line from the point (X, 9) to (X, 0). I have tried \draw[doshed] (X, 0) -- (X, 9); but it ...
3
votes
3answers
56 views

Aligning legends in multiple columns with pgfplots

How can you align the text inside labels with pgfplots? In the example below, I would like to align both the k's and the m's. \documentclass[preview]{standalone} \usepackage{pgfplots} \begin{document}...
1
vote
1answer
58 views

pgfplots matrix plot “perfect” rectangles

Edit: I removed the duplicate part of the question, which was answered here: How to change label and ticks of a pgfplots colorbar? and here: pgfplots: Reshape a MATRIX of data before conditional 3D ...
6
votes
1answer
200 views

How to hide lines behind the surface?

I'm trying to draw some smooth looking surfaces with gridlines, and I'd like the grid lines to be invisible (or transparent or whatever) when they are obscured by my surface. In my code below, you'll ...
0
votes
0answers
30 views

pgf/tikz externalization + tabu: makefile and legend to name problems

I am having troubles with the combination of tabu and pgf/tikz exernalization. Please consider the code snippet below which I try to compile using lualatex or pdflatex using texlive 2018. \...
7
votes
2answers
138 views

Fill area between two parabolas using tikzpicture environment

I was asked to find the integral between x = -4 and x = 4 of the intersection of y_1 = x^2 and y_2 = -x^2. So I recreated it using LaTeX. Please consider the following MWE: \documentclass{article} \...
1
vote
0answers
39 views

PGFplots/groupplots: Understanding the commands dominance of the colorbar ticks style

With groupplots When plotting group plots with colorbar, I used major y tick style in the global groupplot options and y tick style in the colorbar style={}. However, for colorbar style, I found ...
6
votes
1answer
58 views

Making pgfplots parse times (or whatever)

Most likely this is trivial for those with some experience in all these expansion issues, but I have a simple question concerning pgfplots. I want to modify its parsing behavior a bit. (Yes, I am ...
0
votes
0answers
42 views

Fixing “broken” peaks in 3D plot

I am currently trying to get a nice smooth 3D plot using tikz, however, I am failing to do so in only one case. The complied file is smooth in most areas, yet, in the "peal" areas, the plot gets ...
0
votes
1answer
23 views

Only one point visible with pgfplots

I am trying to display multiple plots with pgfplots, but only one point is displayed (with a lot of overlapping) : And the latex : \documentclass{article} \usepackage{pgfplots} \pgfplotsset{width=...
2
votes
1answer
25 views

Normalize by the i-th value of a series

I have a data.csv that looks like (note that there's no header) 0.0, 0.8, 0.5 0.5, 0.4, 0.7 1.0, 1.0, 0.4 that I want to plot using pgfplots. I want the plot to rescale the values in the 2nd (index ...
3
votes
1answer
49 views

pgfplots different ticklength for each axis

Is there an easy way to have different tick length for the X and Y axis? While a lot of the tick formating commands have x and y versions to effect only the corresponding axis, I can't find an axis ...
1
vote
0answers
27 views

pgfplots/standalone: setting new layer trims pgfplot output when called by \includestandalone[mode=tex]

For the main file \documentclass{article} \usepackage{pgfplots} \usepackage[subpreambles=true]{standalone} \pgfplotsset{compat=newest, layers/my layer set/.define layer set={ background,...
0
votes
0answers
31 views

Shading under a curve defined by coordinates [closed]

I have a curve defined by some coordinates. I would like to shade between the curve and the horizontal axis from 0 to 300. My code here does not fill in between the domain 0 to 300. I am no expert, so ...
0
votes
1answer
17 views

PGFPlots Missing column data, but show all x-values regardless

I have a data set where certain columns have missing data. I'd like to plot individual columns of this data on different plots with a consistently sized x-axis. Here's an MWE: \documentclass[]{...
1
vote
1answer
57 views

Show x-labels as time every two hours with pgfplots{dateplot}

I'm trying to plot a simple graph from .csv. I'm using the answer of https://tex.stackexchange.com/a/83929/164280 as basis. I get a could not parse input '00:00:00' as floating point error. I do want ...
2
votes
1answer
33 views

PGFplots: Calculate the title rotation angle to make it parallel to the visibly longer axis

In order to make the title parallel to the visibly longer axis, how is it possible to calculate the rotation angles of both titles (i.e. \FirstTitleAngle and \SecondTitleAngle) instead of the manual ...
1
vote
2answers
33 views

Grid lines with pgfplot dashed lines disappear

I want to make a grid for practicing Kanji (Japanese symbols) I want grid where each cell is divided with dashed lines. If one cell is 1cm or larger it works great. However, I want each cell to be 0.8 ...
0
votes
1answer
42 views

pgfplots coordinate list

I have a straightforward chart, using \addplot with a list of coordinates. Is there a way to insert a break in the line drawn by the coordinate list, something like (x1,y1)(break)(x2,y2) to prevent ...
1
vote
1answer
36 views

Incorrect graphing using pgf plot, graph appears to be inverted with random noise

Shorter version of the problem below (scroll down a bit) I am trying to make this figure here (hand drawn part at the bottom is supposed to be the graph that comes up incorrectly) The equation for ...
0
votes
1answer
21 views

PGFPlots `y` option isn't working with PGFplotsTableRead in multiple lines chart

I have a pretty straightforward line chart I want to make using PGFplotstableread. It seems that when I draw the lines, only the first Y is recognized. \documentclass[11pt, twoside, a4paper]{report} \...
4
votes
1answer
50 views

PGFplots: Print groupplots over multiple pages

For this MWE, I have 8 plots where only 6 are printed where the last two are overlooked. So, is there a way to make PGFplots split the groupplots over multiple pages based on the size of the plot/page?...
4
votes
2answers
79 views

How to produce a legend with a specific text and color in a bar chart with pgfplots?

I am trying to reproduce this image What I tried is this: \begin{tikzpicture} \tikzset{every pin/.style={draw,fill=black!0!white,rectangle,rounded corners=3pt,font=\scriptsize},} \begin{...
2
votes
0answers
30 views

connecting nearest points [on hold]

I'm fairly new to pgfplots and latex and strugling a bit with connecting points in pgfplots. I have a bunch of points and want pgfplots to connect each point to the point next to them. To get a line ...
3
votes
2answers
32 views

pgfplots: Fill between makes xshift/yshift options for axis environment misbehave

I'm using the fillbetween library of pgfplots and I want to shift the position of the axis environment with xshift and yshift options. However, there seems to be a discrepency between what the ...
2
votes
1answer
33 views

Draw line from axis to declared function curve

I have the following code, which displays a normal distribution: \documentclass[tikz, border=1pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usepackage{tikz} \...
1
vote
1answer
47 views

Package pgfplots Error: CRITICAL: shader=interp: got unsupported pdf shading type '0'

For the set of data here, the following code can't compile showing the error Package pgfplots Error: CRITICAL: shader=interp: got unsupported pdf shading type '0'. This may corrupt your pdf!. \...
0
votes
0answers
19 views

pgfplots: legend style breaks \ref for legend to name

I am encountering the situation, where the legend to name with \ref seems to fail whenever I have set a global legend style. Please see \documentclass{book} \usepackage{filecontents} \begin{...
2
votes
2answers
49 views

pgfplots: Fill between breaks background layer

I'm using the fillbetween library of pgfplots and I want to show background rectangle of the enclosing tikzpicture. However, the \addplot fill between command seems to break the background layer. ...
2
votes
2answers
60 views

Plot a function of logarithm with PGFplots

How do I plot a function of a logarithm with PGFplots? Say that I want to plot y=log_3(x). I have a simple Latex code for function y=log_2(x), but I don't know how I can write function of a logarithm ...
1
vote
1answer
29 views

Pgfplots coordinates less than one cause error

I am generating a pgfplots graph to show percentages over time. I am using XeLaTeX to compile the document. When any of the y coordinates are less than 1 the document fails to compile with the error: ...
2
votes
1answer
21 views

Some xticks does not included on the x axis

I noticed that the second \addplot does not recognize its xticks, I have tried the solution here but it does not work. \documentclass{report} \usepackage{pgfplots} \usepackage{tikz} \begin{document} ...
1
vote
1answer
40 views

Move individual data labels in xbar stacked plot

I am trying to plot a set of data as stacked x bars, using pgfplots. My current problem is that since some of the segments are rather short, I don't know how to move only some of them in such way ...
5
votes
1answer
124 views

Combine bar chart with line chart on two Y-axes

I want to combine two Y-axes into one figure. I'm using \pgfplotstableread for my data and I have a style for my bar charts. My code is: \PassOptionsToPackage{table,dvipsnames,svgnames}{xcolor} \...
1
vote
1answer
55 views

Grouped bar chart from csv or xlsx

I want to make a grouped bar chart in LaTeX, using data from a csv (or xlsx) file. I want it to be styled similarly to my other bar charts. I don't know how to get it into the right format and ...
1
vote
1answer
25 views

Alignment / scaling of pgfplot legends

I would like to align two plots containing legends on their outside: \documentclass[a4paper]{article} \usepackage{tikz} \usepackage{tikzscale} \usepackage{subcaption} \usepackage{pgfplots} \...
4
votes
2answers
158 views

pgfplots can not plot this function correctly

Im trying to plot the function y=atan(c^2/(x*sqrt(x^2+c^2/2)), but comparing the result with geogebra i think pgfplots has a issue or my code has an error \begin{tikzpicture}[line cap=round,line join=...
3
votes
1answer
74 views

create a standalone legend for a grid of plots

This question somewhat relates to Using a pgfplots-style legend in a plain-old tikzpicture I'm looking for a better way to do the following. I'm generating a huge amount of data, and from the data I'...
5
votes
1answer
65 views

I am struggling with labeling x axis

Dear ladies and gentlemen, With the following coding, I am getting a graph with an x-axis labeled in scientific way. Instead I need it to be like, 0, 0.02, 0.04, 0.06, 0.08, 0.1. Could you please ...
2
votes
0answers
61 views

One label for each open contour line

I'm trying to set only one label for each contour line, but all the solution for closed contour line failed for open contour lines, like the option label distance=10000pt. How can I do this? \...
0
votes
1answer
51 views

xtick latex hour option

I have many graph using date as x axis, and I wonder if there is an option of xtick to put a tick every hour automatically and not writting every tick like that : xtick = { {2018-04-27 05:00}, {2018-...
3
votes
1answer
27 views

Problem to plot data with dates using an external file

Using logs to make statistics, I have a large number of data which contains two columns, like this (dd-mm-aaaa hh-mm float) 27-04-2018 04:43 7.78269552 27-04-2018 04:44 7.901522832 27-04-2018 ...
0
votes
1answer
37 views

How to group error bars

I would like to reproduce this plot using pgfplots. I can generate a bar plot with error bars. However, if i specify marks only, error bars share the same xtick labels overlap.
3
votes
1answer
44 views

Plotting Normal distribution and tangent line in pgfplots

I'm trying to reproduce the following diagram in pgfplots. My MWE with regenerated graph is below: \documentclass[tikz,border=5mm]{standalone} \usetikzlibrary{positioning} \pgfmathdeclarefunction{...
0
votes
1answer
40 views

pgfplot undefined control sequence - (when using utf-8 files with BOM)

I'm getting undefined control sequence here: but the code and the csv files look alright. (This worked at some point). Any ideas? \documentclass[a4paper,12pt]{article} \usepackage[utf8]{inputenc} \...
0
votes
1answer
34 views

Include average in boxplot

I would like to include an average into my boxplots. The boxplots are made using https://tex.stackexchange.com/a/183856/164280 as an example. I have seen in How to show the mean or average value on a ...
1
vote
1answer
52 views

Layout of bar chart + line chart in \subfloat

Edited I am trying to make my bar charts look nicer than they are now. What I have now: I would like to: Only have the legend at the top graph Have the legend depict a single grey bar for 'Weekly ...
4
votes
1answer
69 views

How to draw line with different markers by pgfplots or tikz?

I would like to draw a line that is similar to the one shown. Now I do something like this. Can someone help me ? Thank you! \documentclass[border=3pt]{standalone} \usepackage{tikz} \usepackage{...
2
votes
1answer
54 views

PGFPlots weighted linear regression error

I'm doing three weighted linear regressions, and the second two are giving me substantially the same answer as I calculate offline, with the first being very wrong. What have I done wrong? As far as ...
2
votes
1answer
64 views

todonotes breaks pgfplots and tikz spy with externalization

I want to use todonotes in a document that also uses pgfplots, tikz spy and tikz external. Unfortunately, todonotes breaks the layout of pgfplots figures as illustrated by the following example: \...