Announcement

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

  • Including labels in the graph

    Hello all,

    I am trying to include the country names next to the trendline in the graph(please see the attachment). Is there a way to do it through a command in STATA other than adding it manually through the insert textbox option?

    Thank you,
    Kanika
    Attached Files

  • #2
    I'd like to know a good answer to this. What I do is use the text option and locate each text line where I want it. You can compute means at particular years etc to get your y-locations and then choose a suitable x-location.

    Comment


    • #3
      You can use -scatter- with the mlabel() option to label the last point and use xscale(range()) to increase the amount of space for the labels:

      Code:
      use weather_summed_2011_2022.dta,clear
      
      //Correct over printing for Amador county 
      gen pos = 3
      replace pos = 4 if county_name == "Amador"
      
      //white_tableau from schemepack:  ssc install schemepack, replace
      line tmax year if fips <  6012 , c(L)  /// 
          || scatter tmax year  if fips <  6012 & year == 2022, mlabel(county_name) ms(none) mlabv(pos)  /// 
          || , legend(off) xlabel(2011(1)2022)   xsc(r(2011 2023)) scheme(white_tableau)  /// 
          ytitle(Cumulative Maximum Daily Temperature) xtitle(Year)
      Click image for larger version

Name:	gr1.png
Views:	1
Size:	75.2 KB
ID:	1722775


      Comment


      • #4
        Many thanks!

        Comment

        Working...
        X