Stacked bar plots with different groups

Welcome to our Forums Technical Support Getting Started Stacked bar plots with different groups

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #9422
    jake_b
    Participant

      hi,

      I would like to create a graph which has 3 different stacked columns, but each column is divided into different categories that are not repeated between columns. (The columns should have 2, 1, and 4 categories respectively.

      I’ve managed to do this using a split axis command, and creating a separate axis for every single category:

      plotexample

      My questions are:

      1. Did I miss a simpler way to do this?

      2. I would like to add a separate legend for each of the 3 columns, but when I try and add a legend, it includes all of the 7 separate groups in a single box. Is there a way to get separate legends to each include just some of the groups?

      thanks!

       

       

      #9423
      dgteam
      Moderator

        The answer to the first question would depend on how your data is formatted.

        If you had a wide table, like this …

        table

        Then a Bars command can make this graph.

        table2

        If you take the same data and Flatten it, so it looks like this:

        table3

        Then you can use a Pivot command.

        table4

        Either approach gets you the same graph with one command, no split canvas needed.

        However, your second question indicates you want to have different legends for each bar.

        The legend command has an option to only list items for the selected axis, when you have a split.  Thus, if you use a split axis, you can have three Legend commands where each one is for a different axis.

        This graph is made by splitting the x axis twice.  Then the Pivot command is copied and pasted twice.  One command is placed on each axis with a mask to limit the data to one of the categories.  Then the three legend commands are added as shown.

        table5

        Is this similar to what you want to do?

         

        #9424
        jake_b
        Participant

          Yes, many thanks – I should have thought of masking the data for the legend. I’ll give it a go and see if I can make it work for my graph.

        Viewing 3 posts - 1 through 3 (of 3 total)
        • You must be logged in to reply to this topic.

        Welcome to our Forums Technical Support Getting Started Stacked bar plots with different groups