Announcement

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

  • How can I create variable width charts or cascade charts in Stata?

    Recently, I have been doing a research on economic structural change, i.e. what is the participation of each economy's industry in the total production and labor absorption, and how does it evolve with time. This kind of phenomenon is easily illustrated using variable width charts or cascade charts. For instance, take a look at this chart (which I generated using LaTeX):

    Click image for larger version

Name:	2001_001.png
Views:	1
Size:	25.8 KB
ID:	1432071


    The x-axis represents the proportion of labor that is employed by certain industry (adding all the columns' width must be equal to 1). The y-axis represents the industry's productivity level as a proportion of the economy's productivity level (e.g. if an industry A has a productivity ratio of 2, it means that its productivity is twice as bigger as the economy's' average productivity).

    I generated this graph using LaTeX, but the process was very time-demanding since I wasn't able to find a suitable package to create it in an automatic way. I also used excel but I was not satisfied with the result since I had to use integers for the columns' width, and the consequent loss of accuracy.

    Therefore, my question is: Is there at least a user-written-command in Stata to automatically generate this graph? I want to generate it in Stata since I used this software for all the data processing process.

    Thanks in advance!


  • #2
    See


    SJ-15-1 gr0063 . . . . . Stata tip 122: Variable bar widths in two-way graphs
    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . B. Jann
    Q1/15 SJ 15(1):316--318 (no commands)
    highlights the bartype(spanning) option of the twoway bar
    command, an undocumented feature that can be used to produce
    bars of different widths


    and its references. (That issue will be publicly accessible when Stata Journal 18(1) is published.)

    Comment


    • #3
      Thank you Nick Cox.

      I find the document very useful but now I have the issue of attaching a single label and color to each rectangle (since each of them represents a single industry).

      Comment


      • #4
        You can only get different colours (that I can think of) by dividing a variable into several variables. separate is dedicated to that purpose. I have to say that this is a design where the principle is easy to understand but making it easily legible and intelligible is immensely harder.

        I'd use side-by-side bar charts or dot charts if this was my problem. (Naturally, I appreciate that isn't the answer you're likely to want.)
        Last edited by Nick Cox; 28 Feb 2018, 14:33.

        Comment

        Working...
        X