Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \begin{figure}[!htbp]
- \begin{tikzpicture}
- \pgfplotsset{
- % define a new style used for the plot used to add labels
- % 2 args means it takes two mandatory arguments, so must be used as
- % labelplot={first arg}{second arg}
- every axis/.style = {
- ybar stacked,
- bar width = 15pt,
- nodes near coords,
- enlarge x limits=0.3,
- ymin = 0,
- ymax = 110,
- legend style = {at={(0.95, 0.85)},
- anchor = east, legend columns = -1},
- ylabel = {Family clusters},
- symbolic x coords = {IT, Analytics, Business},
- xtick = data,
- x tick label style = {rotate = 45, anchor = east, yshift = -4pt},
- },
- labelplot/.style 2 args={
- % forget plot means it doesn't affect cycle lists or legends
- forget plot,
- % #1 is first argument, the text used in the nodes near coords
- nodes near coords=#1,
- % #2 is second argument, a length that should be the same as the bar shift for the axis
- every node near coord/.style={below,font=\tiny,xshift=#2}
- }
- }
- \begin{axis}[bar shift=-17pt, xticklabels={}]
- \addplot coordinates
- {(IT, 74) (Analytics, 19) (Business, 24)};
- \addplot coordinates
- {(IT, 26) (Analytics, 0) (Business, 26)};
- \end{axis}
- \begin{axis}
- \addplot coordinates
- {(IT, 15) (Analytics, 3) (Business, 18)};
- \addplot coordinates
- {(IT, 6) (Analytics, 0) (Business, 9)};
- \end{axis}
- \begin{axis}[bar shift=17pt, xticklabels={}]
- \addplot coordinates
- {(IT, 1) (Analytics, 44) (Business, 25)};
- \addplot coordinates
- {(IT, 42) (Analytics, 0) (Business, 14)};
- \legend{\strut Core, \strut Options}
- \end{axis}
- \end{tikzpicture}
- \caption{Families Per Course Bar Chart} \label{fig:familiesBarChart}
- \end{figure}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement