New answers tagged

2 votes

Plotting x^(x-1)

The problem is that the domain is too high at 0:15, 15^14 is too high for the graph to calculate. Try this code: \documentclass{article} \usepackage[utf8]{inputenc} \usepackage{pgfplots} \usepackage{...
user avatar
3 votes

Plotting x^(x-1)

I use f(x)=x^{x-1}=\exp{(x-1)log(x)} for x>0. The global minimum point is (1,1). Here is an Asymptote code // http://asymptote.ualberta.ca/ unitsize(1.5cm,3.5mm); import graph; real f(real x){...
user avatar
  • 14.2k
1 vote

Handling with customlegend style

In my opinion, creating custom legends, axis and tick labels should be a last resort when using a high level package such as pgfplots. There are several well documented features in the manual that ...
user avatar
  • 33
2 votes

Plotting x^(x-1)

\documentclass{standalone} \usepackage{pgfplots} \usepackage{tikz} \pgfplotsset{compat = newest} \begin{document} \begin{tikzpicture} \begin{axis}[% xmin = 0,% xmax = 15,% ymin = 0,% ...
user avatar
  • 1,659
0 votes

Handling with customlegend style

legend style={nodes={text depth=3mm}} does the trick for me: \documentclass[12pt]{article} \usepackage{tikz} \usepackage{pgfplots} \pgfplotsset{compat=1.16} \usepgfplotslibrary{fillbetween} \...
user avatar
1 vote

How to reveal stacked ybar one symbolic x coord at a time in beamer

You could cover up the bars on earlier overlays: \documentclass{beamer} \usepackage{pgfplots} \begin{document} \begin{frame} \begin{tikzpicture} \begin{axis}[ ybar ...
user avatar
3 votes

Uncover points of scatterplot

A version not using any library, just adding \pause via scatter/@post marker code: \documentclass{beamer} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{frame} \begin{...
user avatar
3 votes

Uncover points of scatterplot

You can use the overlay-beamer-styles library: \documentclass{beamer} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usetikzlibrary{overlay-beamer-styles} \begin{document} \begin{frame} \begin{...
user avatar
1 vote
Accepted

How to extend logarithmic pgfplots to values below 1?

You need stack negative=on previous like this \documentclass[tikz, border=1cm]{standalone} \usepackage{pgfplotstable} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \pgfplotstableread{ ...
user avatar
0 votes

Plotting area under density curve with tikz

With Asymptote // http://asymptote.ualberta.ca/ unitsize(1.5cm,8cm); usepackage("amsmath"); import graph; real xmin=-3, xmax=.32; real mu=0; real sigma=1; real gauss(real x){ return 1/(...
user avatar
  • 14.2k
1 vote

Replicate sidesubfloat with subcaption-package

I would probably rename the external .tikz files to sub1.tikz to sub6.tikz, since then you can easily loop over these files which would reduce you code. As for the caption inside the subplots, you ...
user avatar
1 vote
Accepted

Arbitrarily change axis properties in pgfplots within a foreach loop

You can use \pgfplotsset inside the axis environment to add certain options to the already existing options. If you set the y ticks only to some plots, the scaling of the plots will be different. ...
user avatar
5 votes
Accepted

pgfplots legend marker scale

You should use the option mark size which scales only the marker rather than scale. This way, the markers will also scale in the legend. The option mark size takes a dimension that defaults to 2pt. So,...
user avatar
2 votes
Accepted

Setting pgfplots line opacity based on column name

I hope, I understood you correctly. You can make use of the macro \pgfplotstablegetcolumnnamebyindex. In order to use it, you first need to read the table data into a macro using \pgfplotstableread. ...
user avatar
2 votes
Accepted

Tikz Grid goes beyond graph

\documentclass[tikz, border=1cm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ xlabel=x, ylabel=y, legend pos=north west, ...
user avatar
1 vote
Accepted

pgfplots with nodes near coords fails for some symbolic coords

If you want to style the tick labels, I would suggest using the option yticklabels to define the labels of the y axis. Also, I would probably just use numeric coordinates to position the data on the y ...
user avatar
0 votes
Accepted

Drawing Unconnected 3D Arc in PGFPlots

\documentclass[tikz, border=1cm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ axis lines=middle, ticks=none, view={135}{20}, xlabel=$x$...
user avatar
0 votes

Let a line make an angle with respect to coordinate system

You just need to select the correct starting point for your arc. (For an arc with a radius of 1cm, that's 1cm to the right of its center, i.e. the start of the orange line.) I also uncluttered your ...
user avatar
  • 12.9k
1 vote

Cut-off cone in TikZ

Here's a quick fix for your question about making the inside a different shade of grey, adapted from this question about transparent surfaces. Simply replace the line \addplot3 [surf, color=gray, ...
user avatar
1 vote

3d barplot with colormap / heatmap

In addition to hpekristiansen great answer, i tried some further steps with his example and i would like to share my solution for producing such a 3d bar plot with colormap from an external file: With ...
user avatar
  • 45
2 votes
Accepted

What is the addplot code to draw a simple vertical line of height 0.6 at x=1

pgfplots has a plot type specifically for drawing vertical lines extending out from the x-axis: ycomb. There is a corresponding xcomb for horizontal lines. \documentclass[border=10pt]{standalone} \...
user avatar
3 votes

pgfplots fails to graph the function [sin(x)]^100

Source of your problem is use smooth (spline function) on too small number of sampled. So, if you: increase number od samples, for example to 401, remove smooth instruction, \documentclass[margin=...
user avatar
  • 257k
1 vote

pgfplots fails to graph the function [sin(x)]^100

Try adding samples=100 to your code for sin(x)^100, it should fix the problem. This is the new code: begin{tikzpicture} \begin{axis}[xscale=1.5,axis x line=bottom,axis y line=left, axis x ...
user avatar
3 votes

What is the addplot code to draw a simple vertical line of height 0.6 at x=1

Thanks to the deletion of my previous answer along with your original question, I am now able to digest and rephrase what I originally wrote: Using domain=1 will lead to a syntax error. You need to ...
user avatar
1 vote

pgfplots won't plot simple trig function

Resolved using the following code: \begin{tikzpicture} \begin{axis}[xmin=0, xmax=2, ymin=0, ymax=6000, xlabel=$h\ \mathrm{(m)}$, ylabel=$d\ \mathrm{(m)}$,] \addplot[domain=0:2, smooth] gnuplot[samples=...
user avatar
4 votes
Accepted

Is it a limited numerical precision of Tikz or I don't understand the transformation?

Let's break it down: PGFmath assumee the parameters to sin, cos, etc. to be in degrees, not radians, so we need to convert those either with the deg function or the r postfix operator: sin(deg(x) or ...
user avatar
  • 87.3k
5 votes
Accepted

Place arrow in pgfplots

You can just use the axis coordinate system to draw inside the plot. Inside the axis environment, the units for coordinates are different, so that (1,1) is bound to the units of the axes and does not ...
user avatar
5 votes
Accepted

3d barplot with colormap / heatmap

\documentclass[tikz, border=1cm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \usepgfplotslibrary{patchplots} \begin{document} \begin{tikzpicture} \newcommand{\barw}{0.4} \newcommand{\...
user avatar
1 vote
Accepted

Undesired line between "fill between" regions

Welcome to TeX.SX! This is probably just a rendering error. You can try to use the fadings library and use fill=red!20, path fading=east and fill=green!20, path fading=east for the fadings: \...
user avatar
1 vote
Accepted

Can I customize the legend of my plot?

Can you add options to the \addplot macros? If yes, you can add area legend: \documentclass{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ legend entries={...
user avatar
1 vote

Rounded corners do not transform well in Tikz under a nonlinear transformation

The option rounded corners is quite stubborn sometimes: it has several pitfalls. For instance it does not work well with scale, see pgfmanual.pdf, Section 14.5 Rounding Corners. To avoid using this ...
user avatar
  • 14.2k
2 votes
Accepted

Rounded corners do not transform well in Tikz under a nonlinear transformation

The rounded cornerscommand does not seem to work in this case (see here about it Nonlinear transformation applied on decorations along path with a custom pic). I propose this way to solve this ...
user avatar
  • 500
1 vote
Accepted

PGF boxplot prepared including outliers from file

You cannot simply read a table from a macro due to expansion issues. Instead, I would recommend that you have a look at the macro \pgfplotstabletranspose which may come quite handy here. You can ...
user avatar
0 votes

Z-Order of plots pgfplots

For it worked using \begin{axis}[clip mode=individual,]
user avatar
1 vote
Accepted

Selectively disabling axis labels in tikz-figures without modifying original file

Using \pgfplotsset{/pgfplots/ylabel=\empty} at this place won't have any effect because it will be overridden by the option ylabel={$y$-entry, typically long} that is added to the axis macro in your ....
user avatar
0 votes
Accepted

pgfplots multiple addplots misalignment of symbolic x axis labels

The misalignment is due to the fact that PGF shifts the bars right and left according to their grouping. You have three groups, so the first group is shifted to the left and the third to the right. ...
user avatar
1 vote
Accepted

Pgfplots ignores my last datapoint

You should not use ybar interval but ybar (see this answer): \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{tikzpicture} \begin{axis}[ ...
user avatar
0 votes
Accepted

tikzscale package not working with group plots

I'm not entirely sure if this is the solution you are aiming. But I compile and got the same message with -6.1997pt etc. As I did just small changes following the linked answer cited in comments, I ...
user avatar
  • 3,372
2 votes
Accepted

y minor grid is not showing. why?

You should remove the zero from the ytick list, since your plot starts from y = 60 anyways. In this case you can even omit the ytick option alltogether. I am not fully sure that it is really like this,...
user avatar
2 votes

Save function inside macro for the function’s derivative

First, a note on this: \pgfmathsetmacro{\b}{0.7}; \pgfmathsetmacro{\p}{0.4}; \pgfmathsetmacro{\A}{1}; There should be no ; here because these are not TikZ nor pgfplots statements like \path, \draw, \...
user avatar
  • 23.5k
0 votes

A big value on y coordinates make the other small values almost not able to shown

In my opinion, axis break (this question) is a better solution. However, it is not supported in pgfplots and must be created manually.
user avatar
  • 1
2 votes
Accepted

PGF axis label background is covering axis ticks

An alternative is to extend the axes outside the grid and move their labels. \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=newest} \pgfplotsset{every x tick label/.append style={...
user avatar
1 vote
Accepted

Combination of pgfplot crossreferences and invoke before with externalize produces error

After some trial and error, I have found a solution to both my problems. It seems that it is necessary to have a matching invoke after crossref tikzpicture to the invoke before crossref tikzpicture ...
user avatar
1 vote
Accepted

Adjusting the overlapping percentage numbers in a bar chart

This solution shifts up or down selected nodes near coords \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \pgfplotsset{, xmin=0, /tikz/font=\footnotesize, } \begin{...
user avatar
1 vote

How to move percentage numbers in bar chart horizontally?

I would rotate picture and write labels on bars sides: %\documentclass{article} \documentclass[margin=3mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \begin{document} \begin{...
user avatar
  • 257k
3 votes
Accepted

How to move percentage numbers in bar chart horizontally?

This can be an alternative. \documentclass{article} \usepackage{pgfplots} \pgfplotsset{compat=1.18} \pgfplotsset{, xmin=0, /tikz/font=\footnotesize, } \begin{document} \begin{figure} ...
user avatar
1 vote
Accepted

Error bars in pgfplots symlog bar chart not working

Not sure exactly what's going on, but I think perhaps you can simplify things quite a bit. Instead of separate plots for the error bars, do everything with one \addplot per dataset. You can specify y ...
user avatar
1 vote
Accepted

Alignment of pgfplot inline legend in body text and caption

I found that you can name the legend with legend style={name=leg} (or whatever name you like), which allows you to align its inline representation to its own base using every legend to name picture/....
user avatar
2 votes
Accepted

How can I remove one of the '0' (origin label) for the given graph?

Add the following to the options list of the axis: xtick={1,...,8}, % explicitly sets ticks 1 to 8 for x-axis ytick={50,100,...,300}, % ...
user avatar
2 votes
Accepted

Cannot decorate an empty path in pgfplot

Mixing pgfplots and tikz has a few unforeseen hitches that can catch out the unwary. The first is that \addplot doesn't render its path at the invocation time but rather it gets saved up for the end ...
user avatar

Top 50 recent answers are included