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:  \documentclass[border=1cm]{standalone} \usepackage{pgfplots} \usepackage{pgfplotstable} \pgfplotsset{compat=newest}  \usepackage{filecontents}% write data file to make make MWE self contained  \begin{filecontents*}{test.txt} aa  bb  cc  dd A   7304.91 12713.3 13748.95     B   13628.96    14912.36    19002.29 C   15158.99    29120.11    31566.62 D   23459.77    26894.28    39129.52 E   23095.17    45234.5 50103.37 F   35540.84    38491.29    55900.97 \end{filecontents*}  \begin{document}  \begin{tikzpicture} \pgfplotstableread{test.txt} \datatable \begin{axis}[ ybar, nodes near coords, every node near coord/.append style={xshift=0.05cm,rotate=90,anchor=east,/pgf/number format/.cd,fixed zerofill,precision=2}, bar width= 0.4cm, /pgf/number format/.cd, use comma, width=0.9\textwidth, height=7cm, ymajorgrids,    xtick={data}, scaled y ticks = false, xticklabels from table={\datatable}{aa}, ymin=0,ymax=60000, enlarge x limits = 0.1, ] \addplot[fill=black!20] table [y=bb,x expr=\coordindex] {\datatable}; \addplot[fill=white] table [y=cc,x expr=\coordindex] {\datatable}; \addplot[fill=black!10] table [y=dd,x expr=\coordindex] {\datatable}; \end{axis} \end{tikzpicture} \end{document}   And this is the result:    What I would like now is for the values of the 1st to 5th and 7th bar to be written above the bars, not inside them. What to do?
I created this style that shifts the labels and put them on the bottom of the ybars.  However, I have a problem with the bars that have too short length (for example, see the 8.7 and 5.1 in the example below). I want to check if the values are less than some threshold, or the length of the bar is shorter than the label (number) then change its color.  How can I overlay another label on top of the one in white when the bar is shorter? or maybe change the color of the label to a gradient color? or just overlay the part that is outside of the bar?    \documentclass{standalone}  \usepackage{tikz} \usepackage{pgfplots} \usepackage{pgfplotstable} \usetikzlibrary{calc}  \begin{document} \makeatletter \begin{tikzpicture} \begin{axis}[ ybar, every node near coord/.style={   check for zero/.code={ % If meta=0, make the node a coordinate (which doesn't have text)     \pgfmathfloatifflags{\pgfplotspointmeta}{0}{         \pgfkeys{/tikz/coordinate}     }{}   },   check for zero, color=white, text opacity=1, font=\footnotesize, inner ysep=0.5pt, },% % Bottom nodes  calculate full offset/.code={     \pgfkeys{/pgf/fpu=true,/pgf/fpu/output format=fixed}     \pgfmathsetmacro\testmacro{((\pgfplotspointmeta-\pgfkeysvalueof{/pgfplots/ymin})*10^\pgfplots@data@scale@trafo@EXPONENT@y)*\pgfplots@y@veclength}     \pgfkeys{/pgf/fpu=false} },% nodes near coords bottom/.style={     every node near coord/.append style={         /pgfplots/calculate full offset,         yshift=-\testmacro,         rotate=90, anchor=west,%I need the rotate text here and not in the          %general style, as the ybar redefines the style     } },% ymin=0, nodes near coords={\pgfmathprintnumber[fixed zerofill,precision=1]{\pgfplotspointmeta}}, nodes near coords bottom, ] \pgfplotstableread{ % set real imag mag 1 8.7 2 5.1 3 91.8367  }\mydata \addplot table[x index=0,y index=1,header=false] {\mydata}; \end{axis} \end{tikzpicture} \makeatother \end{document}   * EDIT *  I need to create some special gradient on each label that is below the bar height. For example, I need to adapt something like  to each label that is not showing. However, I cannot find a way to put the macro in the style section of the codes. Or is there any equivalent solution?
"...his parents' dream of *him* achieving a Cambridge degree." What is the function of "him" here? I'm confused about the use of symbols $\vdash$ and  $ \models$. Reading the answers to  and  I see that:  the turnstile symbol $ \vdash $ denotes syntactic implication. Then $ S \vdash \psi$ means that $\psi$ can be derived from the formulae in $S$  the double turnstile $ \models $, denotes semantic implication. Then the notation $A \models B$ means simply that B is true in every model in which A is true.  So I understand that, e.g., $(ZFC+ A) \vdash B$ means that $A \Rightarrow B$ is a theorem in ZFC and, in this sense $\vdash$ is a mathematical symbol for a theorem. While $(ZFC+ A) \models B$ means that $ B$ is true in every model of ZFC in which $A$ is true, and, in this sense $\models$ is not a mathematical but a metamathematical symbol.  I understand correctly? And those are the only uses of the two symbols? rsync two existing directories copying everything I have two file servers in two locations. Currently both have the same data, which generally is unmodified (used for read only access).When the second server was set up (the one I'm sshing to) the data was copied over LAN and has since been moved geographically.  I'm trying to use rsync for the first time on the required directories. An example command;  sudo rsync -avz --ignore-existing -P --dry-run /media/Storage/OSs/ user@mydomain:/mnt/Storage/OSs/   I've tried using -c -t -u (Additionally went on the remote server and updated the timestamps to today) also but every time I execute a dry run it wants to copy everything!  Additionally the user is the same for both machines with the same UID.  *Edit  After playing around a bit more, I've found that rsync does not like the whitespace in the subdirectory names; For instance if I use ' to escape local shell &amp; \ to escape remote shell     sudo rsync -avz --ignore-existing -P '/media/Storage/OSs/Windows/Windows server 2011/' 'user@mydomain:/mnt/Storage/OSs/Windows/Windows\ server\ 2011/'   Then all is well, my theory is then that rsync does not like the subdirectories with whitespaces. I have thousands of subdirectories; the only solution I can think of is to write a small python/shell script to run each sub directory separately but is undesirable. Random quadratic equation I would like to produce quadratic equation with integer coefficients.  Here's my code using pgfmath.  \documentclass{article} \usepackage{tikz} \pgfmathsetseed{\pdfuniformdeviate 10000000}  \begin{document} $\pgfmathdeclarerandomlist{signe}{{+}{-}}% \pgfmathrandomitem{\s}{signe}% \pgfmathparse{random(2)}% \pgfmathparse{ifthenelse(\pgfmathresult==1,"-"," ")}\pgfmathresult \pgfmathrandominteger{\a}{1}{6} \pgfmathparse{ifthenelse(\a==1," x^{2} ","\a x^{2}")}\pgfmathresult % coeff a \pgfmathdeclarerandomlist{lincoeff}{{}{2}{3}{4}{5}{6}} \pgfmathrandomitem{\b}{lincoeff}% \pgfmathrandomitem{\s'}{signe}% \pgfmathsetmacro{\e}{random(0,6)} \pgfmathparse{ifthenelse(\e==0," ", " \s' \b x ")}\pgfmathresult % coeff b \pgfmathrandominteger{\c}{0}{6} \pgfmathrandomitem{\s''}{signe}% \pgfmathparse{ifthenelse(\c==0,"","\s'' \c")}\pgfmathresult % coeff c =0$ \end{document}   It works but it seems to be not a good way, I had some pain with the x-coeficient and my solution looks complicated. I tried to use an ifthenelse inside an other ifthenelse but without success. Is there a better way ? Average length of the longest segment This post is related to a previous SE post  concerning average length of a smallest segment.  A rope of 1m is divided into three pieces by two random points. Find the average length of the largest segment. My answer is 11/18.  Here is how I do it:  Here we have two independent random variables $X,Y$, both uniform on $[0,1]$. Let  $A=\min (X,Y), B=\max (X,Y)$ and $C=\max (A, 1-B, B-A)$. First we want to find the probability density function $f_C(a)$ of $C$. Let $F_C(a)$ be the cumulative distribution function. Then $$ F_C(a) = P(C\le a)=P(A\le a, 1-B\le a, B-A\le a).$$  By rewriting this probability as area in the unit square, I get $$F_C(a)=\left\{\begin{array}{ll} (3a-1)^2 &amp; \frac{1}{3}\le a\le \frac{1}{2}\\ 1-3(1-a)^2 &amp; \frac{1}{2}\le a\le 1\end{array}\right.$$ from which it follows that  $$f_C(a)=\left\{\begin{array}{ll} 6(3a-1) &amp; \frac{1}{3}\le a\le \frac{1}{2}\\ 6(1-a) &amp; \frac{1}{2}\le a\le 1\end{array}\right.$$ Therefore the expected value of $C$ is $$\int_{1/3} ^{1/2}6a(3a-1) da+\int_{1/2} ^{1}6a(1-a) da= \frac{11}{18}.$$  My questions are:  (A) Is there a "clever" way to figure out this number 11/18?  (B) What is the answer if the rope is divided into $n&gt;3$ segments? I love the subset of collective nouns known as the terms of venery. These are collective nouns specific to a particular group of animals. Some of the more inventive examples are: a murder of crows, a crash of rhinos, a mischief of mice, and a puddling of ducks (specifically swimming ducks).  Is there a standard for these group names and is there a central reference for them as with other zoological taxonomy?  I can see in the Wikipedia articles that the practice has its origins in Medieval Hunting tradition, but the Kangaroo (Mob), for instance would have been unknown at that time, so how do new collections come into being? Find the limit: $\lim_\limits{x\to 0}{\frac{\left(1+x\right)^{1/x}-e}{x}}$ iPhone SDK: what is the difference between loadView and viewDidLoad? When working with views and view controllers in an iPhone app, can anyone explain the difference between loadView and viewDidLoad?    My personal context, is that I build all my views from code, I do not and will not use Interface Builder, should that make any difference.  I've found that often when I add init code to loadView, I end up with an infinite stack trace, so I typically do all my child-view building in viewDidLoad...but it's really unclear to me when each gets executed, and what is the more appropriate place to put init code.  What would be perfect, is a simple diagram of the initialization calls.  Thanks! Is there a RSS to the 'Stack Exchange Inbox'? How about to Activity? Just wondering if I'm missing something here. Also, I couldn't find any previous question related to this. Why doesn't a block rotate due to friction? Server login attempts NOT blocked after configuring fail2ban So, I installed (and configured) fail2ban on three Ubuntu VPS servers. I configured (imo) a maximum of 3 failed login attempts (via Putty as root) within 2 minutes. Then I restarted the fail2ban service (according to ).    But when I look at my auth.log files in /var/log/ I still see 4, 5 or more failed attempts from certain IP's. So obviously I did something wrong as the IP is not blocked after 3 failed attempts.   It might have to do something with iptables, but that's where it gets a bit "foggy" for me..   Not sure how to setup a max-three-failed-login-attempts rule..  Additional: I see that the login attempts mostly have different ports for every attempt. Does that influence the count to max-three?  Because I see a port being "poked" twice and then no more attempts. Then the IP tries a different port (again 2 times). (all bots of course) I'm trying to understand the use of super(). From the looks of it, both child classes can be created, just fine.   I'm curious to know about the actual difference between the following 2 child classes.  class Base(object):     def __init__(self):         print "Base created"  class ChildA(Base):     def __init__(self):         Base.__init__(self)  class ChildB(Base):     def __init__(self):         super(ChildB, self).__init__()  ChildA()  ChildB() Is there a closed form expression for $1 + x + x^{4} + x^{9}+x^{16}+x^{25} +..+x^{k^2}$? We all know what the sum of a geometric series is  $1 + x + x^2 + x^3 + ... + x^k = \frac{x^{k+1} - 1}{x - 1}$ .  I was wondering if similar formulas exist in case the exponents  form some other sequence, for example are squares or cubes of positive integers? Figure reference \ref{fig:result} renders as ?? in PDF $$\lim\limits_{x\to 1}\frac{\sqrt x-x^2 }{1-\sqrt x}$$  I'm not entirely sure how to go about this, since rationalizing anything doesn't quite work for me. Just looking for some help. Let $x\in \mathbb{R}$ an irrational number. Define $X=\{nx-\lfloor nx\rfloor: n\in \mathbb{N}\}$. Prove that $X$ is dense on $[0,1)$.    Can anyone give some hint to solve this problem? I tried contradiction but could not reach a proof.  I spend part of the day studying this question   and its answers. Only one answer is clear and give clues to solve the problem. This answer is the first one. However, this answer does not answer the question nor directly, nor the proof follows from this answer.   This answer has some mistakes, he use that $[(k_1-k_2)\alpha]=[k_1\alpha]-[k_2\alpha]$ which is not true. Consider $k_1=3, k_2=1, \alpha=\sqrt{2}$ we have $[(k_1-k_2)\alpha]=2\not= 3=[k_1\alpha]-[k_2\alpha] $. We only can assure that $[k_2\alpha]-[k_1\alpha]-1\leq [(k_2-k_1)\alpha]\leq[k_2\alpha]-[k_1\alpha]$.   Who answered said something interesting about additive subgroups of $\mathbb{R}$, but unfortunately the set $X=\{nx-[nx] : n\in \mathbb{N} \}$ is not a subgroup. Considering the additive subgroup $G=\langle X \rangle$, if we prove the part (a) of the link, we get that indeed $G$ is dense on $\mathbb{R}$ but we can not conclude that $X$ is dense on $[0,1)$.  I think this problem has not been solved.  Thanks! One of the topics that seems to come up regularly on mailing lists and online discussions is the merits (or lack thereof) of doing a Computer Science Degree. An argument that seems to come up time and again for the negative party is that they have been coding for some number of years and they have never used recursion.  So the question is:   What is recursion? When would I use recursion? Why don't people use recursion? Cannot change backlight brightness Ubuntu 14.04 Reading about  I understood that black holes lose energy over time - which is logical in some way (otherwise they would be there forever and heat death would never technically happen)  But - how exactly does it "evaporate"? What happens when it no longer contains enough mass within it's  ? Does it explode somehow? Transforms into "regular matter"? Simply vanishes over time? Or? How can I get a list of all packages in a repository section from command line?