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
3
votes
2answers
32 views

Add a line in a table plot with tikz

I am plotting data with pgfplots. I would like to add a line to this plot. My code is as follows \documentclass{article} \usepackage{pgfplots} \usepackage{tikz} \begin{document} \begin{tikzpicture} \...
0
votes
1answer
24 views

Increase distance of bars in bar chart in pgfplots

I have this code: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{pgfplots} \pgfplotsset{compat=1.16} \usetikzlibrary{patterns} \definecolor{trolleygrey}{rgb}{0.5, 0.5, 0.5} \...
1
vote
1answer
29 views

Counter does not work properly in \pgfmathparse

I have this code: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{graphicx} \usepackage{pgfplots} \usepackage{tikz} \pgfplotsset{compat=1.15} \usetikzlibrary{patterns} \newcounter{...
1
vote
1answer
39 views

PGFPlots - Missing number, treated as zero error - when loading data from file

I am drawing a heatmap/scatter plot with the mark colour determined based on a score. I have mapped scores to Red, Green and Blue values, and trying to colour the marks based on the RGB values. The ...
1
vote
1answer
58 views

How to add extra x coords and some space between bars in tikzpicture

I have this tikzpicture code: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{graphicx} \usepackage{pgfplots} \usepackage{tikz} \definecolor{trolleygrey}{rgb}{0.5, 0.5, 0.5} \...
1
vote
1answer
29 views

Superimposing a plot onto the other in groupplots

I'm trying to present a groupplot in which I basically want to show a two-step transition into the third plot. So, in the first plot, I just have a normal distribution. In the second, I want to have ...
3
votes
3answers
143 views

how can draw a kiviat diagram? [duplicate]

How to draw a kiviat diagram like the following?
1
vote
1answer
24 views

Positioning symbolic labels above bars

Looking to position the symbolic x tick labels above the bars. Also, wondering why the last bar isn't showing correctly. % Minimum working example \documentclass[varwidth=false, tikz, border=10pt]...
2
votes
1answer
24 views

PGF Plots remove padding around axis

I created a nice pattern using pgfplots that I want to effectively use as the background to my generated PDF. The issue is that the plot ends up with a lot of white space around it. I think I have ...
1
vote
2answers
32 views

Colormap drawing order in parametric 3D tube

Similar to this question, I am trying to draw a parametric tube in a PGFplots 3D-plot: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.16} \begin{document} \begin{...
0
votes
1answer
31 views

PGFPlots logarithmic scaling of x axis and ticks base 2

I'm trying to create a plot, where my x axis is scaled to base 2 and the ticks should be at the exact height of the coordinates. I have the logarithmic x axis, but i just can't get the ticks to be at ...
2
votes
2answers
56 views

PGFPlots Line Plot at constant x

In this and this question, we learned how to draw real line plots in 3D axes in PGFPlots by supplying samples y=1 (samples y=0 seems to work as well) or y domain=0:0 to get rid of meshes/matrices. ...
2
votes
1answer
32 views

Remove scientific notation from log plot

Hello stack exchange I have been looking at similar questions but can't make it work. Here is my simplified code : \documentclass[border=2pt]{standalone} \usepackage[utf8]{inputenc} \usepackage{...
2
votes
1answer
34 views

pgfkeys error with pgfplots/colormap

Consider the following MWE: \documentclass[tikz]{standalone} \usepackage{tikz,pgfplots} \pgfplotsset{% compat=newest, colormap={orangeyellow}{color=(orange) color=(yellow)} } \begin{document} ...
0
votes
0answers
28 views

Is it possible to show only the bottom and left axes in pgfplots?

I would like to remove the top and right axes in this graph: Here is my code: \begin{tikzpicture} \begin{axis}[% xlabel={Time}, ylabel={Stock Price}, xticklabels={,,} ] \addplot[line width=1pt,solid,...
3
votes
1answer
58 views

Plotting the difference in y-values between two contour plots

I have the following graphic generated by this code: \documentclass[11pt,a4paper]{scrartcl} \usepackage{pgfplots} \pgfplotsset{compat=newest} \usepackage{amsmath} \begin{document} \begin{...
1
vote
1answer
26 views

Multiple Box Plots on Top of Each Other

I have multiple box plots on top of each other - see the two black box plots in the "400 Iterations" entry - there should be only one (since I'm cycling through the colors), and one of the black plots ...
2
votes
3answers
91 views

Plotting a function defined by equation without closed form solution

I'm trying to have the a silimiar plot to the one Wolfram Alpha provides me here to the equation $24.6347 \left(246.347 x + \sqrt{(246.347 x + 20)^2 + 1} + 20\right)^{-a} =\ 30.2879 \left(-33.6532 x +...
3
votes
1answer
42 views

How to use the coordinate name in round around in tikz?

I'm a student majoring in mechanical engineering and I'm working with plotting the deformation of two links connected at an certain angle. The schematic diagram of the two links is shown below I want ...
4
votes
1answer
47 views

foreach in pgfplots

I want to plot a series of functions, each in another color. I would like to do this with a foreach, but it doesn't work. First I try a simple tikzpicture (from another mwe), this works. Then the ...
2
votes
1answer
28 views

How do I adjust the values ​of the y-axis?

I'm having troubles with the y-axis values of this plot. I don't know how to adjust the y-axis values to get a plot more "relaxed" (Idk how to explain it) The code is \documentclass[12pt,...
1
vote
1answer
23 views

\label and \ref do not work correctly using pgfplots, hyperref and tikz externalization

I have the following MWE: \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.16} \usepgfplotslibrary{external} \tikzset{external/mode=list and make} \tikzexternalize \usepackage{...
1
vote
1answer
23 views

Change axe bar graphs

I wanted to re-create this graphs, with my values but I'm stuck with the bar horizontally and not vertically : \documentclass{article} \usepackage[margin=2.5cm]{geometry} \usepackage{tikz} \...
0
votes
0answers
60 views

Matlab Figure gets “edgy” wir matlab2tikz [closed]

I am trying to plot a figure with matlab2tikz and pgfplots. Everything works fine, but high resolution figures are getting edgy in the exported PDF. Matlab Figure Figure as PDF, Acrobat Reader I ...
1
vote
1answer
26 views

How to place coordinate with particular axis

I want to draw this image: But there is a lot of things that I dont know how to do: I've created my own axis, but how to define the coordonate now ? How can i create the white, and gray rectangle? ...
1
vote
0answers
24 views

tikz `trim axis {left,right}` and y-axis automatic at margin side in a twocolumn layout

I have a few graphs plotted using pgfplots: \documentclass{article} \usepackage{pgfplots} \usepackage{lipsum} \begin{filecontents}{data.csv} 0; 1 2; 3 \end{filecontents} \begin{document} \lipsum[...
0
votes
1answer
30 views

Error when graphing exponential function in pgfplots: Package PGF Math Error: Could not parse input '' as a floating point number

I'm attempting to graph the following function: y = 0.00001096897 + 0.0003330018 * e ^ (−2.521376 * x) However, I keep getting the error message: Package PGF Math Error: Could not parse input '' ...
3
votes
1answer
56 views

pgfplots with LuaLaTeX - totally different results

Here's my code: \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.16,colormap/blackwhite} \begin{document} \begin{tikzpicture} \begin{axis}[view={-60}{40}, hide axis=true, ...
5
votes
1answer
36 views

pgfplots - size of plot and bars don't match the desired values

I created a plot with pgfplot and tried to style it the way I want it to be. For that I chose to add labels and text outside of the block axis, as I want to make a couple of nodes to explain the plot. ...
1
vote
1answer
39 views

Problem in Bézier curves with pgfplots for relative negative coordinates

I attempted to plot some Bézier curves in a pgfplots graph. This works well when the coordinates are positive. See: \documentclass{standalone} \usepackage{pgfplots} \begin{document} \begin{...
2
votes
1answer
28 views

Legend over graphs

The following code makes the legend over the plot (and the size of the plot is too small): \documentclass{article} \usepackage[margin=2.5cm]{geometry} \usepackage{tikz} \usetikzlibrary{arrows,arrows....
2
votes
1answer
33 views

Highlight part of axis with label on top

I have a pgfplot with time as x-axis variable. I would like to highlight certain periods of time and put a name on top of the upper x-axis. \documentclass{article} \usepackage[utf8]{inputenc} \...
2
votes
2answers
38 views

Is there a simple way to define a “one color colormap” in 3D surface plots?

The following MWE does exactly what I want. I'm just wondering if there's an easier, "canonical" way of specifying the color map as I just want black lines. \documentclass{standalone} \usepackage{...
2
votes
1answer
45 views

Pgfplots Scientific Notation 2^x

I am plotting a logarithmic graph and since the values are relatively large, pgfplots is outputting the values in the y-axis in terms of 10x . However, I'd like to output it the format 2x. I read the ...
1
vote
1answer
32 views

Two aligned axes above each other with different x-axis values

I'm trying to generate two different axes above each other with the bottom one being a more zoomed in version of the x-axis of the top one. The data is fetched from a csv file. The CSV reading and ...
1
vote
1answer
13 views

“Node near coord” at the bottom of bar plots, but with symbolic coordinates

I need to place the "node near coords" below the bars of a bar plot instead of above, similarly to this question, but with a difference. \documentclass{report} \usepackage{pgfplots} \begin{document} \...
0
votes
0answers
21 views

Can I truncate very high bars in a pgfplots bar plot? [duplicate]

Please consider this code: \documentclass[11pt]{article} \begin{filecontents*}{table.dat} type v1 v2 v3 v4 v5 v6 v7 t1 0 0 0 0 0 0 0 0 0 0 0 0 0 6 t2 5 17 4 0 0 0 21 0 133 4 91 0 1 93 t3 18 0 ...
1
vote
1answer
22 views

pgfplot without borders nor axis doesn't scale up to \textwidth

I have this code: \documentclass[11pt]{article} \begin{filecontents*}{table.dat} type v1 v2 v3 v4 v5 v6 v7 t1 0 0 0 0 0 0 0 0 0 0 0 0 0 6 t2 5 17 4 0 0 0 21 0 133 4 91 0 1 93 t3 18 0 0 0 18 0 ...
-1
votes
1answer
36 views

don't know the equation of the function but want to plot it [duplicate]

I know how to plot a function if i know the equation but in this case i don't know the equation of itself , thus i want to plot it by using some curve or approximation command thanks for the help
3
votes
0answers
34 views

Align pgfplots horizontally

I want to align the pgfplots seen in the picture below. I already tried with \pgfplotsset{yticklabel style={text width=3em,align=right}}, but as you can see, the plots are still not aligned. The ...
2
votes
1answer
22 views

Modifying circled node to semi circled node and adding title below a plot

Here's a code for the plot of the floor function. I wanted to make some modifications as: changing the red circle to a red semicircle there is two zeros lying on the axes, I want to delete one of ...
2
votes
1answer
20 views

Arranging dissimilar sized pgfplots in tikz

I'm trying to arrange 5 plots so that the first four (equal-sized) are aligned in a 2x2 matrix, and the last one is bigger and is placed. I tried to use the matrix command by changing the width of the ...
1
vote
0answers
44 views

Pgfplots errors

I hope somebody can help me. I am trying to insert some bar charts in my thesis, and I looked for a long time for a solution. I found another question in which the answer was the following code: \...
1
vote
1answer
21 views

pgfplots: y axis arrow pointing down

How can I make the y axis arrow positioned in the other end of the axis and pointing down? \documentclass{article} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage{makecell} \setcellgapes{...
2
votes
1answer
37 views

Plotting the following surface in pgfplots

I would like to plot the surface given by f(x,y) = 1/(1-xy) over the range [0,1]×[0,1], with the plot range being [0,5]. Update: I managed to obtain the above plot, but I want the red region to be ...
2
votes
1answer
73 views

Shade area above y = x line for a scatter plot

So i've been trying draw a line of y = x on my scatter plot and shade the area above (y > x) in green. \begin{tikzpicture} \begin{axis}[legend pos=north west,% xmode = log, ymode = log, ...
1
vote
1answer
38 views

How could I split the text of the x axis labels?

I'm doing a bar graph with pgfplots. The labels of x axis are looking disproportionate and I don't know how to fix it. Is there anyway to make them better? Furthermore, It could be better if the ...
2
votes
1answer
25 views

How can I move certain nodes near coords in a bar chart depending on their value? [duplicate]

I want to write the values of bars in a bar chart (ybar) inside each bar, except for when there is not enough space. In that case, I want to write the value above the bar. This is my code: \...
3
votes
4answers
112 views

pgfmath / gnuplot: How to use gnuplot for complicated calculations?

Is there a way to use gnuplot for complicated calculations? For \pgfmathsetmacro{\x}{0.02} \pgfmathsetmacro{\y}{2*11000*(1 - 1.40576 - cos(\x) + sqrt(1.40576^2 - sin(\x)^2))} for example I get '...
3
votes
2answers
51 views

pgfplots: How to hide “nodes near coords” if value is 0 (empty)?

Assumed we have this Minimum Working Example (MWE): \documentclass{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ ybar, ...