Announcement

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

  • Two-way scatter plot title and axis title

    Dear All,

    I am trying to do a two way scatter plot from my analysis. The code which i am running in a do file is below:
    Code:
    sum abnormal_return, d
    sum cumulative_abnormal_return, d
    reg cumulative_abnormal_return if dif==0, robust
    
    preserve
    collapse (mean) abnormal_return, by(diff)
    twoway scatter abnormal_return diff if diff>=-2 & diff<=2, xlab(-2(1)2) c(l) xline(-1) xline(1)
    restore
    My output graph is given below

    Click image for larger version

Name:	Graph.png
Views:	1
Size:	23.1 KB
ID:	1674786


    My ideal graph should look like the following graph

    Click image for larger version

Name:	Ideal Graph.png
Views:	1
Size:	8.3 KB
ID:	1674785

    Please suggest me how to change my code to get the x axis title and y axis title, the graph title on the top.

    Looking forward to your suggestion

    With sincere regards,
    UP

  • #2
    Add the options:

    Code:
    xtitle("My X title") ytitle("My Y title") title("My title")

    Comment


    • #3
      Hi Andrew,

      Thanks for your reply. Why I am not getting the vertical line in middle?

      With sincere regards,
      Upananda Pani

      Comment


      • #4
        your code in #1, shows the use of the "xline()" option but only has two so you get two lines; add another xline option where you want the middle line or even just use one xline option such as
        Code:
        xline(-1 0 1)

        Comment


        • #5
          HI Rich Goldstein, I am grateful to you for your reply. It works fie.

          Comment

          Working...
          X