Announcement

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

  • Connecting labels from X axis (scatter plot) to a String Variable

    Good afternoon,

    I'm trying to recreate this graph:
    Click image for larger version

Name:	Image 1.PNG
Views:	1
Size:	71.4 KB
ID:	1559152

    However, I'm having problems changing my variable X from from ID (in this case a countryID I created) to the actual name of the countries.

    Code:
    encode Country, gen (CountryID2)
    twoway scatter CR CountryID2, xlabel (1(1)51, angle(90) valuelabel)
    The problem that occurs is: "parentheses do not balance". I also tried writing each ID by hand (example: xlabel(1 "Argentina" 2 "Brazil"...)

    Thank you!

  • #2
    the problem is the space following "xlabel" - just move the parenthesis so it directly follows the "l" of "xlabel" without a space

    Comment


    • #3
      I cannot believe that was the problem! I was so worried with the code that made a simple mistake like that!
      Thank you very much!

      Comment


      • #4
        That solved, I would suggest

        sorting the countries by their means

        showing country on the vertical axis to avoid axis labels on a slant

        dropping the connecting line, which has no meaning

        making the mean symbols more visible by offsetting from their associated values.

        Comment

        Working...
        X