Announcement

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

  • Adding Color to Different Labels with Coefplot

    Hi all!

    Does anyone have ideas on how to change the color of the headings within coefplot ?

    coeflabels(1 = "{bf:First Row}" 2 = `""{bf:Header 1 , That I'd like to be Bold and Red}}" "{bf:Second Row}" "(R{sup:{it:2}}{sub:{it:adj}} = `r2_row_2')""' 3 = `""{bf:Third Row}" "(R{sup:{it:2}}{sub:{it:adj}} = `r2_row_3')""' .....

    Any thoughts would be greatly appreciated!

  • #2
    coefplot is from SSC (FAQ Advice #12). coefplot may call these coeflabels, but these are axis labels using twoway terminology. There is no option to specify different colors for the axis labels, see

    Code:
    help axis_label_options
    However, you can use the graph editor to do this. If you need to do this often, obtain the recording, generalize it and run this using the undocumented gr_edit command.

    Comment


    • #3
      maybe:
      Code:
      clear all
      sysuse auto
      regress price mpg headroom trunk length turn
      
      coefplot, ///
          drop(_cons) ///
          xline(0)  ///
          ylab(1 `""""', custom labcolor(none)) ///
          ylab(1 `"{bf:row one bold red}"', add custom labcolor(red)) ///    
          ylab(2 `"row 2 navy"', add custom labcolor(navy)) ///  
          ylab(3 `"row 3 dkgreen"', add custom labcolor(dkgreen)) ///
          ylab(4 `"row 4 dkorange"', add custom labcolor(dkorange)) ///
          ylab(5 `"{it:row 5 it red}"', add custom labcolor(red))
      Click image for larger version

Name:	bf_red.png
Views:	1
Size:	56.7 KB
ID:	1761577

      Last edited by Bjarte Aagnes; 14 Aug 2024, 15:34.

      Comment


      • #4
        This works for twoway, so the statement in #2 is incorrect. I did not know you could have multiple -ylab()- options.Thanks for this Bjarte Aagnes.

        Code:
        sysuse auto, clear
        scatter rep78 mpg
        scatter rep78 mpg, ylab(5 "Excellent", add custom labcolor(red)) ///
        ylab(4 "V. good", add custom labcolor(blue))

        Click image for larger version

Name:	Graph.png
Views:	1
Size:	16.5 KB
ID:	1761582

        Comment

        Working...
        X