# Tag Info

17

PGFPlots is printing the log transformed x value. To print the non transformed value, set point meta=rawx. (Similarly for ybar, use point meta=rawy to get the raw y value.) Note that bar plots with logarithmic axes are a really bad idea, since the zero point of logarithmic plots is arbitrary and the length of the bar doesn't carry any information. A dot ...

12

I think the easiest way to do it is as you've done, keeping in mind that if there are N equally spaced points, the pos-ition of the n-th point is (n-1)/(N-1). In your case you have 5 points and you want to mark the second, so it should be at position 0.25: \documentclass{standalone} \usepackage{pgfplots} \usepackage{pgfplotstable} % For \...

11

You can adapt the method from Center nodes near coords in a stacked ybar plot to use nodes near coords for the labels: \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \begin{document} \makeatletter \pgfplotsset{ calculate offset/.code={ \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed} \pgfmathsetmacro\testmacro{(\...

11

I would use the nodes near coords functionality for this, which allows you to associate the labels directly with the coordinates, regardless of the spacing. With a bit of TikZ style acrobatics, you can define a key nodes near some coords={1,3} that takes either a single coordinate index or a list of indices, and activates the label printing only for those ...

10

As standard node near coordinates is \pgfmathprintnumber{\pgfplotspointmeta}. You want to run that only if \pgfplotspointmeta is non-zero. This may be tested for with \pgfmathfloatifflags as follows: near coords={\pgfmathfloatifflags{\pgfplotspointmeta}{0}{}{\pgfmathprintnumber{\pgfplotspointmeta}}} with 0 indicating test whether the number is equal to ...

9

This is one possible solution. Firstly, move every node near coords down a little bit via every node near coord/.append style={yshift=-0.5cm} % yshift can be adjusted Then adds to the addplot[options] a particular nodes near coords (the blue one) via raisebox nodes near coords=\raisebox{0.7cm}{\pgfmathprintnumber\pgfplotspointmeta} % 0.7 can be ...

8

The key fixed zerofill only applies numbers that also use the fixed style (that's a bit confusing). So if you set \pgfkeys{ /pgf/number format/precision=1, /pgf/number format/fixed zerofill=true, /pgf/number format/fixed } you'll get the desired output: \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{...

8

It does not work in your MWE because you are overwriting it by also giving the option nodes near coors to the \addplot command. Remove the latter one (or specify format here), and it will print. I added a thinspace before the percentage sign, although it can also be recommended to load the siunitx package and let that format and typeset the values for you. ...

8

By default nodes near coords prints \pgfmathprintnumber{\pgfplotspointmeta}. You can add a percent sign by saying nodes near coords=\pgfmathprintnumber{\pgfplotspointmeta}\% \documentclass{article} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ symbolic x coords={A,B,C}, nodes near coords=\pgfmathprintnumber{\...

7

You are overriding the style of the nodes so you need /.append style instead Modifying only these lines nodes near coords align={right}, every node near coord/.append style={font=\tiny, inner sep=1pt}, leads to

7

Besides adding the circles "manually" as John Kormylo has suggested in the comments below the question, here a more "automatic" solution. (This is very related your question: Add ellipse around data point part 2.) % used PGFPlots v1.14 \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \newcommand{\dsnfive}{prob5_2.dat} \begin{...

7

Set reverse legend in the axis options, and add forget plot to those \addplot commands you don't want to appear in the legend. Also, you only need either the two \addlegendentry commands, or the \legend command, but not both. \documentclass{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.3} \begin{document} \begin{tikzpicture} \begin{axis}[ ...

7

Because you weren't very specific I guessed that you meant something like the following ... % used PGFPlots v1.14 \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ xbar, tick align=outside, width=11cm, height=8cm, bar width={...

6

A way is to exploit the siunitx package similarly to: pgfplots: Set exponent of scientific number format for nodes near coords The code: \documentclass[png,tikz,border=10pt]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.8} \usepackage{siunitx} \begin{document} \begin{tikzpicture} \pgfkeys{ /pgf/number format/precision=1, /pgf/number ...

6

Remove this style option every node near coord/.append style={anchor=south}, and replace it with the following options: nodes near coords align={anchor=south}, nodes near coords bar offset=1 Now, even if you increase the offset in your table by random amounts, the nodes will always appear nicely on top, without the need for you to manually shift them. ...

6

I don't know exactly what kind of changes you will need, but perhaps this could be a starting point. My approach is basically to use calc library to compute the coordinates of the dots. \documentclass[border=2mm]{standalone} \usepackage {amsmath} % for pmatrix \usepackage {tikz} \usetikzlibrary{calc} % for coordinates \begin{document} \begin{...

5

Yes, you can. For details on how to do that, please have a look at the comments in the code. % used PGFPlots v1.14 \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \pgfplotsset{ TornadoPlot/.style={% Overall settings width=\textwidth, height=7cm, xmin=-50, xmax=50, line ...

5

In PGFPlots v1.13 your example now works with the new key stack negative=separate. Here the full code, which can also be found in the manual in the section 4.5.9 on page 99. \documentclass[border=5mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.13} \begin{document} \begin{tikzpicture} \pgfplotstableread{ Year Cat1 ...

5

Here is a solution that works without visualization depends on. Please note that I have truncated the given code to just one plot, because there is nothing new in the second one and only would make the code even longer. I also removed a lot of styles etc. which almost didn't change the output and weren't related to the questions, so would also just "...

5

I would shift the nodes on blue columns slightly to the left, and nodes on the red columns slightly to the right by using the every node near coord/.append style={xshift=<dim>} key together with the \addplot+ command (instead of \addplot). MWE \documentclass[border=2pt]{standalone} \usepackage{pgfplots} \pgfplotsset{ base/.style={ ymin=0, ...

5

I would manually place the nodes. Takes a bit more work, but I think the results are better: Notes: I added clip=false so that the text of the node was not cut off. Code: \documentclass{article} \usepackage{pgfplots} \usetikzlibrary{decorations.markings} \begin{document} \begin{tikzpicture} \begin{axis}[ compat=newest, height=0.4\textheight, ...

5

My suggestion would be to update your pgfplots package. From pgfplots version 1.9, nodes near coords gives a better result. Compare the result with version 1.8: \documentclass{article} \usepackage{pgfplots} % to print charts \pgfplotsset{compat=1.8} \begin{document} \begin{figure} \centering \begin{tikzpicture} \begin{axis}[ ybar ...

5

I adapted the code from the link you provided in the question to give the desired result. Because only the x values have tick lines it is needed to draw three axis: One for the "man" data, one for the "woman" data and one only for plotting the ydata, because the tick length cannot be set independently for the x and y axis. For more details have a look at ...

5

So I guess you are searching for something like the following, right? For more details on how it works, please have a look at the comments in the code. % used PGFPlots v1.14 \begin{filecontents}{data.csv} COUNT,CREATE,MODIFY,SAVE,LOAD,QUERY,QMOD,DETACH,SAVE2 100,64.27,5.63,19.05,13.71,0.38,0.66,3.11,9.50 1000,64.57,20.03,44.80,35.52,1.32,2.93,12.49,18.84 ...

5

The enlargelimits=0.15 is adding extra space below the data and to the left of the data. By setting enlargelimits=false and then enlarge x limits=0.15 you can fix the axis issue. The nodes near coords is creating the label for the two data series. In the solution below, I've removed this from the options for the axis, and added it to the options for the \...

5

Edit: A small variation of @rbrgnall answer (+1), with use of table (differences are marked in code by % <---%): \documentclass[margin=3mm]{standalone} \usepackage{pgfplots} \pgfplotsset{compat=1.16} % <--- \usepackage{pgfplotstable} % <--- \usepackage{siunitx} % <--- \pgfplotstableread[col sep=comma]% % <--- { state, ...

4

To avoid the hyphenation in the yticklabel: yticklabel style={text width=0.2\textwidth,align=flush left}, To hide value 0 as nodes near coords: nodes near coords={% \pgfmathtruncatemacro\NNC{\pgfkeysvalueof{/data point/x}}% \ifnumequal{\NNC}{0}{}{\NNC}% needs package etoolbox }, To avoid xtick scaling: scaled x ticks=false, To prevent nodes near ...

4

Your MWE is far from minimal; I reproduced the situation with a much simpler file. The .log file shows everything you need to know: LaTeX Font Warning: Font shape `T1/cmss/m/n' in size <1> not available (Font) size <5> substituted on input line 74. Numerous warnings like this show up when compiling your MWE. The standard fonts are ...

4

I am not 100% sure if I have understood your question right, but hopefully it is not so far away from what you really wanted to do. I think the simplest solution is to draw two axis environments on top of each other; one holding the stacked bar plots and the other the mark and line plot. For more details on how the solution works, please have a look at the ...

4

This can be done, but it is the question if this is more elegant than your already provided solution. For more details on how this can be done, please have a look at the comments in the code. % used PGFPlots v1.14 \documentclass[border=5pt]{standalone} \usepackage{pgfplots} \begin{document} \begin{tikzpicture} \begin{axis}[ only marks, %...

Only top voted, non community-wiki answers of a minimum length are eligible