Announcement

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

  • Stata Graph

    Hi everyone,

    I am using Stata 15.1. Whenever I get a Stata graph, it is not connected at the origin. I followed this recommendation https://www.statalist.org/forums/for...-to-start-at-0, it did not help me, probably I am unable to modify the message in it.
    For example, using the Auto data in Stata:

    Code:
    tw ///
      (scatter weight length , mc(gray)) ///
      (lpoly weight length , lc(red)) ///
      (scatter weight length ///
        if rep78 == 2 ///
        , mlab(make) mlabsize(vsmall) mlabc(black) mc(black)), yscale(r(0)) ylab(#6)
    My questions are: how can I get the y and x axes connected at the origin?
    And why is there a large distance between the beginning of the data points in the graph and the x-axis? Can we correct it too?
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	81.6 KB
ID:	1677455

    In case, how it looks in my eyes, I did attach a picture of the graph.
    I would appreciate tips and advices. Thank you.
    Last edited by Philmon Amasalu; 11 Aug 2022, 22:53. Reason: I forgot linking the tip I was following from Statalist

  • #2
    That is a feature of your scheme which I presume is cleanplots from https://www.trentonmize.com/software/cleanplots.

    And why is there a large distance between the beginning of the data points in the graph and the x-axis? Can we correct it too?
    In your code, you ask that Stata begins the y axis at 0, so you get what you ask for. Stata does not allow truncation of data, so you can specify a larger starting value if it does not truncate the data.

    Code:
    sysuse auto, clear
    set scheme cleanplots
    tw ///
      (scatter weight length , mc(gray)) ///
      (lpoly weight length , lc(red)) ///
      (scatter weight length ///
        if rep78 == 2 ///
        , mlab(make) mlabsize(vsmall) mlabc(black) ///
        mc(black)), yscale(r(1000 .)) ylab(#6) plotregion(margin(0))
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	42.9 KB
ID:	1677484

    Comment


    • #3
      Dear Andrew, thank you very much. Yes, I was using
      cleanplots
      . Both schemes produce the same graphs unless your recommendations are included. Thank you once again for your helpful advices.

      Comment

      Working...
      X