Announcement

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

  • Line Graph Legend.

    Hi There,

    Does anyone know why when you go about 19 in labeling y's for a line graph, it is no longer recognized and the legend provides only the label of the variable?


    Example: When I get to Slovakia, it simply labels it and the remaining variables as the name of the variable and not Slovakia.

    twoway (line log_IQVIA_pCap year if Country=="AUT", lpattern(dash) lcolor(green)) ///
    (line log_IQVIA_pCap year if Country_Code=="BEL", lpattern(dash) lcolor(khaki)) ///
    (line log_IQVIA_pCap year if Country_Code=="CZE", lpattern(dash) lcolor(lavender)) ///
    (line log_IQVIA_pCap year if Country_Code=="DNK", lpattern(dash) lcolor(lime)) ///
    (line log_IQVIA_pCap year if Country_Code=="EST", lpattern(dash) lcolor(ltbluishgray)) ///
    (line log_IQVIA_pCap year if Country_Code=="FIN", lpattern(dash) lcolor(ltkhaki)) ///
    (line log_IQVIA_pCap year if Country_Code=="FRA", lpattern(dash) lcolor(magenta)) ///
    (line log_IQVIA_pCap year if Country_Code=="DEU", lpattern(dash) lcolor(maroon)) ///
    (line log_IQVIA_pCap year if Country_Code=="GRC", lpattern(dash) lcolor(midblue)) ///
    (line log_IQVIA_pCap year if Country_Code=="HUN", lpattern(dash) lcolor(midgreen)) ///
    (line log_IQVIA_pCap year if Country_Code=="IRL", lpattern(dash) lcolor(mint)) ///
    (line log_IQVIA_pCap year if Country_Code=="ITA", lpattern(dash) lcolor(navy)) ///
    (line log_IQVIA_pCap year if Country_Code=="LVA", lpattern(dash) lcolor(olive)) ///
    (line log_IQVIA_pCap year if Country_Code=="LTU", lpattern(dash) lcolor(olive_teal)) ///
    (line log_IQVIA_pCap year if Country_Code=="LUX", lpattern(dash) lcolor(orange)) ///
    (line log_IQVIA_pCap year if Country_Code=="NLD", lpattern(dash) lcolor(orange_red)) ///
    (line log_IQVIA_pCap year if Country_Code=="POL", lpattern(dash) lcolor(pink)) ///
    (line log_IQVIA_pCap year if Country_Code=="PRT", lpattern(dash) lcolor(purple)) ///
    (line log_IQVIA_pCap year if Country_Code=="SVK", lpattern(dash) lcolor(sand)) ///
    (line log_IQVIA_pCap year if Country_Code=="SVN", lpattern(dash) lcolor(sandb)) ///
    (line log_IQVIA_pCap year if Country_Code=="ESP", lpattern(dash) lcolor(sienna)) ///
    (line log_IQVIA_pCap year if Country_Code=="SWE", lpattern(dash) lcolor(stone)) ///
    (line log_IQVIA_pCap year if Country_Code=="GBR", lpattern(dash) lcolor(teal)) if year > 2009, ///
    title("log of per capita IQVIA revenue by Top20 Pharma - EU and Canada") ///
    legend(label(1 "Austria")) ///
    legend(label(2 "Belgium")) ///
    legend(label(3 "Czech")) ///
    legend(label(4 "Denmark")) ///
    legend(label(5 "CostaRica")) ///
    legend(label(6 "Estonia")) ///
    legend(label(7 "Finland")) ///
    legend(label(8 "France")) ///
    legend(label(9 "Germany")) ///
    legend(label(10 "Greece")) ///
    legend(label(11 "Hungary")) ///
    legend(label(12 "Ireland")) ///
    legend(label(13 "Italy")) ///
    legend(label(14 "Latvia")) ///
    legend(label(15 "Lithuania")) ///
    legend(label(16 "Luxembourg")) ///
    legend(label(17 "Netherlands")) ///
    legend(label(18 "Poland")) ///
    legend(label(19 "Portugal")) ///
    legend(label(20 "Slovakia")) ///
    legend(label(21 "Slovenia")) ///
    legend(label(22 "Spain")) ///
    legend(label(23 "Sweden")) ///
    legend(label(24 "United Kingdom"))

  • #2
    Could you put in a small data example (with a few observations for each of your countries) using dataex, so it is easier for us to replicate your issue?

    Comment


    • #3
      Stata does have a limit here which is (I guess) intended to be more than anyone could plausibly want, and that has failed if you trigger the limit.

      Backing up, the question is whether this design could possibly work well, with 24 criss-crossing lines and a legend that will take up a great deal of space. In principle the data are shown faithfully; in practice spaghetti is likely.

      As a quite different detail, Costa Rica is not in the EU or Canada, nor indeed is Britain. The legend items and your line calls do not match one-to-one.

      Comment


      • #4
        Thanks Nick. Ok that is good to know there is indeed a limit. I was wondering if I had done something wrong. You are correct in noticing my Typo on Costa Rica, thank you. Britain was part of the EU during the data collection period and Canada is the country I am looking at comparing with this group.

        Hemanshu thanks as well. the data would be an x y z table with a country, number, year as data.

        Comment

        Working...
        X