Announcement

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

  • Put a different ytitle in each yaxis.

    Hello,

    I am doing a graph with two y axes. I would like to put a different ytitle in each of them but I am not able to do it. I use the following code:

    Code:
    twoway line Vaccinations year, c(l) yaxis(1) ytitle("Log(Vaccinations)") ///
    legend(label(1 Log(Vaccinations))  label(2 Log(Deaths)) label(3 Log(Deaths2))) ///
     || line Deaths year, c(l) yaxis(2) ytitle("Log(Deaths)")  ///
     || line Deaths2 year, c(l) yaxis(2)
    That code just maintain in my left y axis the title "Log(Deaths)". However, I would like to have in my left y axis the title "Log(Vaccinations)" and in my right y axis the title "Log(Deaths)". Any suggestion is more than welcome.

    Last edited by Diego Malo; 20 May 2022, 03:12.

  • #2
    Consider this example


    Code:
    webuse grunfeld, clear
    
    line invest year if company == 1, yaxis(1 2) ytitle(Investment, axis(1)) || line mvalue year if company == 1, ytitle(Market value, axis(2))

    Comment


    • #3
      I get it! Thank you Nick Cox . You know everything.

      Comment


      • #4
        Really not so!

        Comment

        Working...
        X