Stack Exchange Network

Stack Exchange network consists of 175 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

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.

1
vote
1answer
21 views

pgfplots: Adding vertical lines with labels to a graph

I wanted to replicate the following graph in latex. I'm using the pgfplots package. The main areas I'm struggling with is how to implement vertical lines with labels, how to make the tick-marker on ...
3
votes
2answers
22 views

nodes near coords from table

I want to add a non-numerical value as a node on a histogram. The labels come from a column in a table, fairly similar to this other question, i.e. using value \thisrow{<column>} as <macro>...
0
votes
2answers
20 views

pgfplots: Reducing Marker Size

Do you know how can I reduce the size of the markers? code: \documentclass{book} \usepackage{caption} \usepackage{subcaption} \usepackage{epsfig} \usepackage{contour} \usepackage{bm} \...
2
votes
1answer
19 views

Plotting parametric, scalar-valued function over parametric surface using pgfplots

I think this is a relatively simple question but I can't seem to find the answer anywhere. Suppose I have a set of parametric equations for a cylinder that I can plot using the following snippet of ...
0
votes
0answers
34 views

How to position multiple pgfplots tikzpicture in a single figure

I'm newer to latex and pgfplots, and have a question on how I can position multiple tikzpicture in a single figure. In my example, there are 15 tikzpicture in the figure - 3 rows and 5 columns. How ...
1
vote
1answer
28 views

Difficulty Expressing Function For Plotting

I'm attempting to use pgfplots to plot a graph with the following code \begin{tikzpicture} \begin{axis}[ axis lines = left, xlabel = $n$, ylabel = {$p_{n}$}, ] \pgfmathsetmacro{\P}{520000} \...
3
votes
1answer
37 views

Plotting a star in a 2D plot

Do you know how can I get the following star marker when plotting a 2D plot? This is what I have tried: \documentclass[border=10pt]{article} \usepackage{tikz} \usepackage{pgfplots}\pgfplotsset{...
1
vote
1answer
36 views

2D Tikz Line plot style

I am trying to get something that resembles what's on the picture: I don't know, it looks so good. Maybe it's because of the font or some trick I have no idea about. So far I was able to plot this: ...
3
votes
2answers
71 views

Plot U-shaped probability distribution using TikZ-PGF

I would like to plot the "u-shaped" or "bathtub" probability distribution using TikZ-PGF. Using the u-quadratic's probability density function (pdf), I got the following results: \documentclass[...
2
votes
1answer
53 views

Plot along path in TikZ

I'm trying to automate drawing filled plots along (mostly straight) paths. A simple example of what I'm trying to achieve: \documentclass[border=2cm]{standalone} \usepackage{tikz} \usetikzlibrary{...
1
vote
1answer
21 views

pgfplots: print rounded values with statistical errors in parentheses

I recently discovered pgfplotstable and it is great to typeset auto-generated tables. Consider, for example, the following MWE: \documentclass[border=10pt]{standalone} \usepackage{pgfplots} \...
2
votes
1answer
18 views

pgfplotsextra: draw on top of markers and lines

I am using a setup that is similar to this MWE: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis} \addplot[domain=-2:2,mark=x] {sin(deg(...
5
votes
1answer
38 views

Using GNUplot to create a heatmap in pgfplots

I am trying to create a heatmap using tikz/pgfplots in latex, I however get an empty plot. I use the same command as I used in GNUplot, which was plot 'heat-data.txt' matrix with image; In GNUplot ...
2
votes
1answer
71 views

Labeled energy level transition pgfplots/Tikz

I'd like to build an energy transition diagram (same as Energy level transition pgfplots/Tikz [code below]). However, I would like to add label on it. \documentclass{standalone} \usepackage{pgfplots,...
2
votes
1answer
39 views

2D Plot with labels

Can you give me a hint on how could I draw such a plot? Literally I have no clue about how should I start. I could draw two straight lines but my problem comes up when it comes to bending them. Not ...
1
vote
0answers
20 views

Using pgfkeys to make a custom tikzpicture command with multiple use of addplot

Consider this MWE: \documentclass{article} \usepackage{tikz,pgfplots} \usepackage{pgfkeys} \usepackage{xparse} \usepackage{filecontents} % DATA 1 \begin{filecontents*}{data1.txt} 1 1 2 4 3 9 4 16 5 ...
3
votes
1answer
31 views

pgfplots: How to smoothen a 3D surface plot?

Long time has passed - based on this and this question I would like to know if pgfplots does already support surface smoothening of coordinate based 3D plots in 2019? Minimum Working Example (MWE): \...
0
votes
1answer
44 views

fill between and axis on top causes title to be behind grid lines

I want to color an area between two plots using the fillbetween library. Additionally, I want my grid lines on top of the plot (i.e. "axis on top", like in pgfplots' area style; I can't use area style ...
1
vote
1answer
22 views

Precision difference between \pgfmathsetmacro and \pgfplotsretval

I am currently working on some datasets with pgfplots and pgfplotstable. At some point, I need to store some cell values for mutiple uses so I use a \pgfmathsetmacro{\somevar}{\pgfplotsretval} call. ...
1
vote
1answer
35 views

Add axes all around the plot in tikzpicture

I have a figure and I have ploted some value. My issue is that I cannot seem to be able to specify that the figure should have axis on all sides. My figure: I would like to have the borders like in ...
1
vote
2answers
27 views

Different scale in bar plot

I am creating a bar plot for a situation, however the scale of each bar is different and should be represented in the scale of 10. My code is: \documentclass[runningheads]{llncs} \usepackage{graphicx}...
3
votes
1answer
53 views

Drawing: nodes and arrows

Hello fellows and folks! I need an extra help with the following picture: Since this picture has copyrights, I found similar free icons of copyrights. Could you give me a hand with the nodes and ...
0
votes
0answers
28 views

Standard deviation Plot

I have a table with mean values of correctness and the standard deviation with respect to them. My hit ratio is represented as a percentage. The table is: My first question is: Is the standard ...
0
votes
1answer
44 views

I cannot plot this negative graph for some reason on Latex

I am trying to plot the equation -\frac{7}{6}\frac{1}{16\pi^2}x^3 but I keep getting the error, missing number treating as zero. I have no idea what is going on because I am a newbie at this.
1
vote
1answer
35 views

Tell pgfplots to put tick labels between tick marks

Is it possible to tell pgfplots to put tick labels between the tick marks instead of at the tick marks? MWE: \documentclass[margin=5pt]{standalone} \usepackage{tikz} \usepackage{pgfplots} \begin{...
1
vote
1answer
19 views

Pgfplots skips yticks

I'm trying to make a graph using pgfplots, where the y-ticks are evenly spaced from 0 to 100, so: 0, 10, 20 etc. But when I create this graph the y-ticks immediately go from 0 to 30, after which they'...
2
votes
2answers
21 views

macro within pgfplots in beamer

I want to create a macro so that in a beamer presentation it produces the same plot with slightly different data. But it seems as though a problem exists before I include an argument in the macro. ...
0
votes
1answer
28 views

Resizing two subfigures inside a figure

Hello folks and fellows! I need to resize these two tikZ plots which are created when I run the whole tex document, so I don't think that \includegraphics[width=.9\linewidth]{something.png} would ...
2
votes
1answer
35 views

pgfplots: How to draw mesh of 3D plot only in y direction (but not in x direction)?

Assumed we draw a simple 3D plot with pgfplots. Minimum Working Example (MWE): \documentclass{standalone} \usepackage{pgfplots,pgfplotstable} \usepackage{filecontents} \begin{filecontents}{testdata....
3
votes
2answers
34 views

Pgfplot. Reduce intensity of an RGB color

I want to reduce the intensity of the fill in the graph. However, specifying !10 after the RGB color in the fill section, results in an error. I really need to use the RGB color, to be consistent with ...
0
votes
2answers
58 views

Commas in formatting: y-values

When I compile the following code with the whole Tex document, it prints comma. On the other hand, if I compile it in a new single document, it prints the periods. Do you know what may be causing ...
3
votes
1answer
38 views

Drawing two curves in the same plot with labels

Hello fellows and folks! I need to draw the following curve. Could you please give me a hand? I tried my best the other day but I had serious problems with the labels inside and outside the plot. ...
1
vote
1answer
21 views

Use data points from table to generate an untirupted line pgfplot

I have this figure: The continuous line is the gauss function plotted. I want to replace the function with my data points (which is the the red-dotted line) and look the same. Meaning having a ...
0
votes
0answers
20 views

Wrong position xticklabels with un-intact data [duplicate]

The following MWE making a plot by pgfplots shows xticktables in wrong position along the x-axis. I think this is caused by lost data. So, is there a approach to make these xticktables in right ...
1
vote
1answer
34 views

Dimension too large error - tan graph

I have put a restriction on the y values but I still get a `dimension too large' error. Can anyone suggest how to prevent the error? \documentclass[12pt]{article} \usepackage{amsmath,amsthm,amssymb,...
1
vote
2answers
50 views

Fill area below curve from filecontents in PGFPlots [duplicate]

I would like to shade an area underneath a curve. Although this has received attention in previous posts, such as this, I am instead plotting some data using the filecontents package - so the function ...
3
votes
3answers
139 views

Aligning group plot titles horizontally

I'm trying to figure out why my plot titles are not horizontally aligned. I tried several sources but could not find an option to control title alignment. Below image is what I get. As you can see ...
3
votes
1answer
38 views

How to plot a dashed line for some data predictions followed from a solid line from historical data

Problem I have a set of data from a .dat file, which every value could be "historical" or "prediction". year emision data_type 2008 9.24309 hist 2010 8.50724 hist 2012 8.06490 ...
2
votes
1answer
69 views

Plotting graph with piecewise linear interpolation

I want to plot a graph with piecewise linear interpolation from a CSV data file. Currently, I have only managed to plot a graph like the following one: Here is my Latex code: \documentclass{article} ...
0
votes
0answers
13 views

pgfplots input axis settings from an external file [duplicate]

I want to plot multiple figures with the same settings, but different content. I would then like to be able to change the settings in all plots at the same time. To achieve this, I'd like to store the ...
1
vote
1answer
28 views

Pgfplots y label and extra ticks positioning problem

When I have a y label on a plot, and I add an extra tick with a long description on the right, the y label gets shifted to the left. This seems to be a layout bug in the pgfplots code. What is the ...
0
votes
0answers
86 views

Including python matplotlib plots in LaTeX documents and inheriting document font properties

I am trying to get a standardised method to import plots from matplotlib into my LaTeX document, borrowing text formatting from the main document (so I want to avoid pure PDF). I am currently ...
1
vote
1answer
34 views

Color the space under the ploted line in a pgfplot

I have plotted some values on a pgfplot and I wish to color in red the part under the line. Some suggestion about a package or what I need to look into would be great. In this case googling it did not ...
2
votes
1answer
34 views

Misplaced bar in grouped bar charts

The first column, which corresponds to the leftmost bar in each group is shifted heavily to the left. Why? (The tikzpicture has to be in a beamer environment.) \documentclass{beamer} \...
4
votes
2answers
84 views

Jumping frame contents with beamer and pgfplots

I'd like to show a function using different values for it's domain, like "zooming out" over a series of frames. Using the following code, both the text before the plot and the plot's axes/frame jump ...
4
votes
1answer
41 views

Replace bar charts in a figure with text for each Y variable

I have a figure that was initially a bar chart. I replaced the values with text in the middle. I want the text to be aligned left inside the graph for each Y value. There is also a middle line ...
1
vote
1answer
27 views

Style of lines in raw gnuplot and pgfplots

I am drawing a function using raw gnuplot in pgfplots and I am not able to make the lines thicker and to change the colour (for instance grey). My example is the following: \begin{tikzpicture} \...
2
votes
2answers
44 views

Cannot shift plot in Tikz picture

I have nodes that are placed at specific positions in my Tikz picture, and I would like to put a plot next to it. To do this, I am using a shifted scope. However, when I change the shift values, ...
1
vote
1answer
32 views

How to globally declare a function for PGFplots

I would like to be able to "globally" declare a function for use in PGFplots. That is, I want to be able to declare a function a single time, and be able to use it without having to declare it on ...
3
votes
2answers
35 views

Display difference between two locations on plot

I've been trying to display the difference in y between a point and a line. This code \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.9} \usetikzlibrary{calc} \begin{document} \...