Announcement

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

  • Adding marker labels on a sepscatter or separated scatter plot

    Hello,

    I'm working with a dataset for which I want to create a graph with 4 quadrants. I have two variables I am plotting against each other: dissent which is a 1 or -1 and an unemployment rate gap. I am able to use the sepscatter package but the marker labels are only displayed on the first group. The marker labels return when I do not split the observations into groups. Is there a way to get my marker labels to display with the shapes of sepscatter?

    Here is the Stata code that I am using:

    Code:
    *************** QUADRANTS GRAPH ****************************
    gen u_diff = u_rate - UNRATE
    g dissent_jit = dissent + rnormal(0, 0.1)
    
    g qdate = qofd(FOMCMeeting)
    format qdate %tq
    
    sepscatter dissent_jit u_diff if dissent != 0 & year > 2002, sep(district) ///
         mlabsize(tiny) mlabel(qdate)
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	56.8 KB
ID:	1709854

    Thanks in advance

  • #2
    sepscatter is from SSC.

    See the documented mylabel() option, e.g.

    Code:
    . sysuse auto, clear
    (1978 automobile data)
    
    . sepscatter mpg weight, separate(foreign)
    
    . sepscatter mpg weight, separate(foreign) mylabel(foreign)

    Comment


    • #3
      Thanks I see that you can use mylabel() to create labels as the points on the plot, but I can't then have the shapes encoded in the legend as another variable.

      The final product I'm aiming for is the sepscatter above with each point labeled by their date and then corresponding to a number in the legend. I'm sorry for asking again, maybe I'm missing something here.

      Adding the mylabel() option just removes all the other points leaving only "1"


      Code:
      sepscatter dissent_jit u_diff if dissent != 0 & year > 2002, sep(district) ///
               mlabsize(tiny) mlabel(qdate) mylabel(qdate)
      Click image for larger version

Name:	Graph2.png
Views:	1
Size:	42.4 KB
ID:	1709869



      Likewise, by removing mlabel() we lose the shapes which I need for my groups, only leaving the labels as the groups.

      Comment


      • #4
        I can't see your data, but in essence sorry, but what you want to do isn't supported by sepscatter, which at root is a convenience command necessarily reflecting my own tastes. Indeed the intent is to do without legends altogether if possible.

        Comment


        • #5
          What you want seems a recipe for a very crowded graph that won't be easy to interpret. But speaking in terms of sepscatter, that was me picking up on the earlier idea of using separate, and indeed this was one reason,why the separate command was written in the first place. So https://www.stata-journal.com/articl...article=gr0023 might help in terms of techique.

          Comment

          Working...
          X