No announcement yet.
  • Filter
  • Time
  • Show
Clear All
new posts

  • Combined graph of distribution of several variables

    I am trying to make a graph with 9 variables, all with the same label. I would like it to look like the attached picture. Does such a commando exist, or do I have to install another package. As of now I have installed the catplot package.
    TOKYO -- Prime Minister Shinzo Abe's landslide victory in Sunday's general election has extended the ruling camp's winning streak to five national ele

  • #2
    What you want is a horizontal stacked bar charts, which looks nice, but is not very good. The first and the last group can be easily compared, but the intermediate groups are much harder. A better alternative would be tabplot (from SSC).
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz


    • #3
      Thanks to Maarten for the plug, but tabplot is published in, and now maintained through, the Stata Journal:

      SJ-17-3 gr0066_1 . . . . . . . . . . . . . . . . Software update for tabplot
      (help tabplot if installed) . . . . . . . . . . . . . . . . N. J. Cox
      Q3/17 SJ 17(3):779
      added options for reversing axis scales; improved handling of
      axis labels containing quotation marks

      SJ-16-2 gr0066 . . . . . . Speaking Stata: Multiple bar charts in table form
      (help tabplot if installed) . . . . . . . . . . . . . . . . N. J. Cox
      Q2/16 SJ 16(2):491--510
      provides multiple bar charts in table form representing
      contingency tables for one, two, or three categorical variables

      So, if interested, in Stata go

      search tabplot, sj
      and use the latest given source to download files.


      • #4
        Thank you for your answers, I have tried your suggestions, but it does not seem to work.
        I have tried using the tabplot, however when combining more variables, I get the distribution of answer 1 from question 1 over answer 1 of question 2 etc.
        What I want, is just one graph with all the variables shown, but not with them being crossed. Is there a command for that?


        • #5
          Code you don't show us doesn't seem to work with data you don't show us. That's hard even for experienced users to disentangle.

          Let's start with your 9 variables. You can't show 9 variables with tabplot.

          My guess is that you have 9 categories of one variable shown as 9 variables. To get closer to what Stata can do, and that means most commands in this territory, you will need some kind of reshape.

          I could make more guesses, but it's better that you give us your data, or at least a data example, following
          Last edited by Nick Cox; 25 Mar 2019, 17:00.