Announcement

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

  • marginsplot changing value labels.

    I am trying to add labels beside markers for a marginsplot from gologit2.

    gologit2 q38 ib3.mol_managerb_num , vce(robust) npl (1.mol_managerb_num)

    margins mol_managerb_num

    marginsplot, xdimension (mol_managerb_num) recast(scatter) plot(_predict) name (grantpreferenceman, replace) yscale(range(0 .6)) ylabel(0(.1).6) xtitle("") title("Figure X. Predicted Probability of Likelihood of being" "Granted Work Preference by Manager Status") xscale(range(0.5 3.5)) xlabel(1 "Executive" 2 "Middle Manager" 3 "Non-Manager" , labsize (small)) legend(lab(1 "Not or Slightly Likely") lab(2 "Moderately Likely") lab(3 "Very Likely") lab(4 "Extremely Likely") order(1 "Not or Slightly" 2 "Moderately" 3 "Very" 4 "Extremely" )) plotopts(mlabel(_predict))saving (granta, replace)

    So I would like for the labels (predict(pr_outcome(5)), (predict(pr_outcome(4)), (predict(pr_outcome(3)), and (predict(pr_outcome(2)) to instead have the value labels presented in the legend (Extremely, Very, Moderately, Not or Slightly). Ultimately, I will also remove the legend. Is this possible? Thank you.

    Click image for larger version

Name:	Figure X.jpg
Views:	1
Size:	91.5 KB
ID:	1693130

  • #2
    Those are value labels stored by margins after the predictions. One way would be to save the margins output and relabel the variable "_predict", then use twoway to generate the entire graph. It may be possible to export the predictions to the current dataset and use the -addplot- option, specifying marker labels for the added plot only. Will not attempt to test that. On plotting using the margins output, see https://www.statalist.org/forums/for...et-for-clarity. If all this seems too hard, you may try to see if you can change the labels directly using the graph editor.

    Code:
    *START WITH
    margins mol_managerb_num, saving(mymargins)
    use mymargins, clear
    Last edited by Andrew Musau; 12 Dec 2022, 14:44.

    Comment

    Working...
    X