Announcement

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

  • no space allocated for labeling category axis with graph dot / graph hbar

    I am making dot graphs over various categorical variables, and for one of them (provider), Stata doesn't allocate any space for the labels of the different categories. Both provider (doesn't work) and province (does work) are labeled, numerical variables. Note that it looks fine with the vertical option. I same thing happens using graph hbar : no space allocated to label the different values of provider. (If you open the graph with the graph editor, you see that no space is allocated for grpaxis.)

    Code:
    . des provider province
    
                  storage   display    value
    variable name   type    format     label      variable label
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    provider_       byte    %14.0g     provider_vax
                                                  
    province        byte    %10.0g     provs17    Province (2017 frame)
    
    . graph dot paid [pw = _pweight], over(care) asyvar over(provider)
    
    . graph dot paid [pw = _pweight], over(care) asyvar over(province)
    
    . graph dot paid [pw = _pweight], over(care) asyvar over(provider) vertical







    Data excerpt:
    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input str9 care float _pweight byte province float paid_ byte provider_
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 1 2
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . 2
    "vax"       247.86473 1 0 2
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 0 2
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . 2
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 1 2
    "sickchild" 247.86473 1 . 4
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 1 4
    "vax"       247.86473 1 0 3
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 0 2
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 0 2
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 0 2
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 1 1
    "vax"       247.86473 1 0 2
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 1 2
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 1 1
    "vax"       247.86473 1 0 2
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 1 1
    "vax"       247.86473 1 0 2
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 1 1
    "vax"       247.86473 1 0 2
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 1 2
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    "sickchild" 247.86473 1 . .
    "vax"       247.86473 1 . .
    "ANC"       247.86473 1 . .
    end
    label values province provs17
    label def provs17 1 "East", modify
    label values provider_ provider_vax
    label def provider_vax 1 "gov't hospital", modify
    label def provider_vax 2 "gov't clinic", modify
    label def provider_vax 3 "mobile team", modify
    label def provider_vax 4 "other", modify

  • #2
    As I write (and as I read) the images are unreadable. Please note the advice to post images as .png. If you used any other file format, that is unlikely to work.

    It's your first graph that is problematic. I get a better result by tweaking the aspect ratio:

    Code:
    set scheme s1color 
    graph dot paid [pw = _pweight], over(care) asyvar over(provider)  aspect(1)

    Comment


    • #3
      You can specify how much space you want allocated to the margin.

      Code:
      graph dot paid [pw = _pweight], over(care) asyvar over(provider, axis(outergap(20)))

      Comment

      Working...
      X