Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Latex 1.71 KB | None | 0 0
  1. \begin{figure}[!htbp]
  2. \begin{tikzpicture}
  3. \pgfplotsset{
  4.   % define a new style used for the plot used to add labels
  5.   % 2 args means it takes two mandatory arguments, so must be used as
  6.   % labelplot={first arg}{second arg}
  7.   every axis/.style = {
  8.        ybar stacked,
  9.        bar width = 15pt,
  10.        nodes near coords,
  11.        enlarge x limits=0.3,
  12.        ymin = 0,
  13.        ymax = 110,
  14.        legend style = {at={(0.95, 0.85)},
  15.            anchor = east, legend columns = -1},
  16.        ylabel = {Family clusters},
  17.        symbolic x coords = {IT, Analytics, Business},
  18.        xtick = data,
  19.        x tick label style = {rotate = 45, anchor = east, yshift = -4pt},
  20.    },
  21.   labelplot/.style 2 args={
  22.      % forget plot means it doesn't affect cycle lists or legends
  23.      forget plot,
  24.      % #1 is first argument, the text used in the nodes near coords
  25.      nodes near coords=#1,
  26.      % #2 is second argument, a length that should be the same as the bar shift for the axis
  27.      every node near coord/.style={below,font=\tiny,xshift=#2}
  28.  }
  29. }
  30. \begin{axis}[bar shift=-17pt, xticklabels={}]
  31. \addplot coordinates
  32. {(IT, 74) (Analytics, 19) (Business, 24)};
  33. \addplot coordinates
  34. {(IT, 26) (Analytics, 0) (Business, 26)};
  35. \end{axis}
  36. \begin{axis}
  37. \addplot coordinates
  38. {(IT, 15) (Analytics, 3) (Business, 18)};
  39. \addplot coordinates
  40. {(IT, 6) (Analytics, 0) (Business, 9)};
  41. \end{axis}
  42. \begin{axis}[bar shift=17pt, xticklabels={}]
  43. \addplot coordinates
  44. {(IT, 1) (Analytics, 44) (Business, 25)};
  45. \addplot coordinates
  46. {(IT, 42) (Analytics, 0) (Business, 14)};
  47. \legend{\strut Core, \strut Options}
  48. \end{axis}
  49. \end{tikzpicture}
  50. \caption{Families Per Course Bar Chart} \label{fig:familiesBarChart}
  51. \end{figure}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement