Announcement

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

  • y-axis (scale) problem

    Dear All, I found this question here (https://bbs.pinggu.org/thread-9190477-1-1.html). Basically, the question is how to obtain a graph like this?

    Click image for larger version

Name:	y-axis.png
Views:	1
Size:	116.6 KB
ID:	1564452


    In particular, the scale of y-axis is unusual. Any suggestions are appreciated (Sorry, no data is provided).
    Ho-Chuan (River) Huang
    Stata 19.0, MP(4)

  • #2
    I assume this is a log scaling, so this should work:
    Code:
    scatter YVAR XVAR, yscale(log) ylabel(0.001 0.01 0.1 1)
    Best wishes

    (Stata 16.1 MP)

    Comment


    • #3
      That just looks like log scale on the vertical axis to me. You will need to spell out which axis labels and axis ticks you want. Without purporting to replicate that graph, I think this example shows the main syntax needed.

      Code:
      clear 
      set obs 1
      gen y = 0.1 
      gen x = 6
      
      scatter y x , ysc(r(0.01 1) log) yla(1 0.1 0.01, ang(h) tlength(*2)) ymtick(0.02(0.01)0.09 0.2(0.1)0.9, tlength(*2)) xla(0(2)12)

      Comment


      • #4
        Dear Felix, Thanks for the suggestion. However, I am not sure whether it is a "log" scaling. Thus, I make up the following data:
        Code:
        * Example generated by -dataex-. To install: ssc install dataex
        clear
        input float(y x)
           1  0
          .9  2
         .75  4
          .7  6
         .09  8
        .008 10
        end
        Any further suggestions? Thanks.
        Ho-Chuan (River) Huang
        Stata 19.0, MP(4)

        Comment


        • #5
          The values 1 0.1 0.01 0.001 look equally spaced to me. That is a logarithmic scale. I can't see any need for further suggestions unless you can explain what else you think it is.

          Comment


          • #6
            I agree with Nick Cox that the Y axis is logarithmic scaling.

            Perhaps it would look like more familiar logarithmic axes if the units Y is measured in were scaled down by a factor of 1000 (say, from kilometers to meters), so the axis labels were 1, 10, 100, and 1000, but the result is the same. Equal distances between equal multiples defines a logarithmic scale.

            Comment


            • #7
              Dear Nick, Thanks a lot. This example helps.
              Ho-Chuan (River) Huang
              Stata 19.0, MP(4)

              Comment


              • #8
                Dear William, Thanks for the explanation.

                Ho-Chuan (River) Huang
                Stata 19.0, MP(4)

                Comment

                Working...
                X