Announcement

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

  • scatter plots with comparable circle size/weight in two graphs

    Hi Stata users,

    I am writing to ask a question on how to draw two weighted scatter plots with circles where the size of the circles are comparable.

    My current code looks like the following:
    Code:
    scatter v1 v2 [w=pct] if sample == 1, msymbol(circle_hollow)
    scatter v1 v2 [w=pct] if sample == 2, msymbol(circle_hollow)
    However, the graphs are not comparable because the weighting option reweights the percent variable for each sample, so the circle sizes are not comparable.

    I wonder if there is a convenient way to make the scale of circle sizes comparable between the two graphs.

    Thanks a lot, and I look forward to hearing from you!

    Best,
    Long
    Last edited by Long Hong; 08 Oct 2022, 15:38. Reason: scatter, circle

  • #2
    Use the by(sample) option rather than two if qualifiers. Naturally if there are other values of sample you need a qualifier too.

    Comment


    • #3
      Thanks, Nick Cox!

      It seems that by(sample) produces the same results as the ones using qualifiers.

      Comment


      • #4
        See https://journals.sagepub.com/doi/abs...urnalCode=stja

        Comment

        Working...
        X