Announcement

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

  • Changing label characters when using spmap

    Hello all.

    I have some special need: I'd like to change labels in maps produced with spmap to bold to make them even more readable. I usually would increase character size, but I'd prefer to have them bold in this special case. I know I am asking something difficult: through the forums the problem has arisen before, and no workable solution was proposed.

    Thanks for reading.

  • #2
    Here is one way to make labels in boldface. It adds the SMCL (Stata Markup and Control Language) directives (tags) for boldface to the string variable make. You could use a similar approach with value labels.
    Code:
    . sysuse auto
    
    . replace make = "{bf:" + make + "}" in 1/5
    
    . twoway (scatter price mpg, mlabel(make)) in 1/10
    David Radwin
    Senior Researcher, California Competes
    californiacompetes.org
    Pronouns: He/Him

    Comment


    • #3
      Originally posted by David Radwin View Post
      Here is one way to make labels in boldface. It adds the SMCL (Stata Markup and Control Language) directives (tags) for boldface to the string variable make. You could use a similar approach with value labels.
      With elabel (SSC), this is easy to do

      Code:
      sysuse auto
      elabel define (foreign) (= #) (= "{bf:" + @ + "}") , modify
      To see the changes, you will (for now) have to use Stata's label list command, which requires the value label name

      Code:
      . label list origin
      origin:
                 0 {bf:Domestic}
                 1 {bf:Foreign}
      You cannot use elabel list to view the changes* because the latter interprets SMCL when displaying value labels. I will change that in a future update.

      Best
      Daniel

      * Edit: Actually, whether you see any differences will depend on the chosen (Results Color) preferences; what I meant to say is: elabel list does not display value label verbatim.
      Last edited by daniel klein; 13 Nov 2019, 00:54.

      Comment


      • #4
        Thanks both, I am going to test these workarounds as soon as possible!

        Comment

        Working...
        X