Announcement

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

  • Histogram how to define interval on x axis

    Hello,

    I have created a variable for the hourly wages of workers. I would like to see the distribution because there may be observation with very low and very high hourly wages, which should me removed from the analysis. However, creating a histogram, , it looks like the attached picture. But the interesting part of hourly wages are from 0-350$, which I dont see in my graph. I tried also the x scale properties and extend the range scale, but looks similar to the attached file with x axis in 1000 interval. Is there a way to change the x axis interval to 1? This may solve my problem.

    Code:
    sum    hourlyw
    
        Variable    Obs    Mean    Std. Dev.    Min    Max
                            
        hourlyw    32,641    47.42683    46.65561    .000641    3585.942

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float hourlyw
    27.382326
    19.444445
     6.452594
    19.358974
    16.962912
     38.67308
    24.278847
           25
    10.650887
    24.725275
     5.769231
    26.785715
    10.833333
    16.783216
        15.75
    18.559067
    13.391026
    14.880953
    33.115383
           18
     9.499519
         15.2
     21.46207
    19.826923
           17
     11.45105
         19.5
    27.439024
    11.461538
    25.555555
    24.085365
     41.66667
     19.23769
     4.944597
    25.471153
    12.666667
      17.0625
     20.58371
     42.45513
    19.026735
        13.75
         24.7
     27.63187
    25.989714
    18.294872
    19.133173
    23.296904
    24.452595
     4.614469
    25.634615
     24.33894
     25.96154
    20.348837
     26.91135
    22.156355
    23.195885
    24.725275
    23.033653
     21.95122
     25.59524
     9.958791
    27.906977
       26.875
    23.076923
     9.997954
     26.16279
    31.153847
    24.725275
    12.820513
           18
    23.359375
      22.2561
     23.38034
           25
    17.189903
    21.634615
           25
    29.761906
     6.732646
     42.33013
    23.809525
    23.809525
     26.27976
           25
    19.792734
           33
     23.70304
           38
    15.835577
     25.32833
     28.22024
    23.303846
     21.39231
     24.40476
    17.742674
        18.75
    13.736263
     26.59475
       28.125
     7.678571
         22.5
    24.197674
    24.107143
     77.17308
     20.91987
    22.781673
    20.833334
    34.641182
    18.772894
     30.57548
     24.90077
    24.107143
     7.933894
     28.52427
     19.19423
           17
     25.59524
     89.12981
     22.15909
    27.083334
     22.32143
     9.774038
     19.23077
           23
     22.89377
        23.75
    15.279305
    24.089893
       29.375
    23.809525
    21.234615
     26.59475
    23.214285
    18.793707
      28.3328
     5.952381
     17.17033
     17.17033
           20
     29.48031
    21.354166
    25.641026
     24.23077
    24.390244
           25
    20.166666
      24.6641
           25
     14.57784
    26.785715
    19.320215
     45.33974
     20.46795
     40.85096
    21.815475
    27.083076
     21.11111
     24.33894
     20.19231
    12.820513
     30.53663
    23.809525
     21.09375
    18.541666
     17.33371
    27.472527
    14.343077
    23.076923
     30.02102
     27.60373
    28.063187
    23.333334
     25.59524
     24.03846
    20.454546
     22.32143
           15
    19.642857
    17.948717
    22.557245
         10.1
           36
      24.2674
    23.809525
     14.78547
           30
    29.026556
    116.66666
     24.99701
     21.42857
     28.56058
    12.551282
     22.61905
    19.857143
    23.573717
    21.910715
       24.375
    29.761906
    18.112701
           18
    4.5888276
     21.10943
    23.255814
    31.177404
    19.166666
         32.5
           31
    27.908653
    16.694445
    23.585096
    23.428705
       28.125
           25
     20.84397
        26.25
           31
    17.647058
    17.772116
    29.692766
     25.00262
     77.28846
        23.75
     57.65128
           32
    20.604395
    25.576923
           24
     25.59524
     25.44231
    25.390625
    29.814903
    25.609756
     25.89872
     19.56619
     20.87912
    23.809525
    17.622377
     22.89377
    18.333334
    26.041666
    32.307693
     23.07143
    24.169325
      27.7125
    22.093023
      29.0522
    26.309067
    27.020193
           28
      68.5601
     26.57967
         32.5
     5.506993
    21.940704
     23.95171
    20.535715
           25
     19.64469
    26.964285
      42.1978
     24.51923
       20.009
     25.59524
     22.22222
    17.695192
    27.439024
    27.259615
    24.725275
     20.85225
    34.615383
      18.1337
        29.25
           25
    27.220695
     22.61905
    23.809525
     24.03846
    21.667307
     20.87912
     19.23077
    15.384615
     25.96154
    167.07034
           25
           25
    26.190475
     12.69952
    15.384615
     26.31579
     22.06731
     26.16279
    28.846153
     27.38095
    18.539803
    26.610577
     22.01346
           25
     22.38372
     23.07097
     27.97619
    end
    Attached Files

  • #2
    Maybe you can leave the maximum values out of the graph? those that are higher than 350.

    Otherwise you can try:

    histogram hourlyw, discrete
    or

    Code:
    histogram hourlyw, discrete freq addlabels ylabel(,grid) xlabel(0(25)350)
    Take a look at

    Code:
    help histogram
    Best,

    Comment


    • #3
      You can change bin start and width. Do read the help for histogram.

      That said, wages seem best seen and analysed on logarithmic scale.

      Please post graphs as .png, not .gph. This is explained in the FAQ Advice.

      Comment


      • #4
        thank you both for your advice!

        Comment

        Working...
        X