0

I am trying to reduce the size of text around the chart . I already tried tiny and every node near coord/.append style={font=\tiny} but its make too small. Please help me

\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}

\begin{document} \begin{tikzpicture} \begin{axis}[ xbar stacked, width=15.6cm, height=7cm, bar width=15pt, nodes near coords={ \pgfkeys{/pgf/fpu=true} \pgfmathparse{\pgfplotspointmeta / 106 * 100} $\pgfmathprintnumber[fixed, precision=1]{\pgfmathresult}%$ \pgfkeys{/pgf/fpu=false} }, nodes near coords custom/.style={ every node near coord/.style={ check for small/.code={ \pgfkeys{/pgf/fpu=true} \pgfmathparse{\pgfplotspointmeta<#1}% \pgfkeys{/pgf/fpu=false} \ifpgfmathfloatcomparison \pgfkeysalso{above=.5em} \fi }, check for small, }, }, nodes near coords custom=6, xmin=0, xmax=109, xtick={0, 10.6, ..., 106.1}, ytick={1,...,5}, yticklabels={A,B,C,D,E}, xtick pos=bottom, ytick pos=left, xticklabel={ \pgfkeys{/pgf/fpu=true} \pgfmathparse{\tick / 106 * 100} $\pgfmathprintnumber[fixed, precision=1]{\pgfmathresult}%$ \pgfkeys{/pgf/fpu=false} }, enlarge y limits=.15, legend style={at={(0.5,-0.20)}, anchor=north, legend columns=-1}, ] \addplot coordinates {(54,1) (49,2) (42,3) (41,4) (37,5)}; \addplot coordinates {(3,1) (7,2) (1,3) (7,4) (16,5)}; \addplot coordinates {(34,1) (28,2) (50,3) (43,4) (30,5)}; \addplot coordinates {(12,1) (20,2) (9,3) (11,4) (19,5)}; \addplot[color=violet, fill=violet!50] coordinates {(3,1) (2,2) (4,3) (4,4) (4,5)}; \legend{\strut Agree, \strut Strongly agree, \strut neutral, \strut Disagree, \strut Strongly disagree} \end{axis} \end{tikzpicture} \end{document}

Henri Menke
  • 109,596
Waseem
  • 97

0 Answers0