Announcement

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

  • Erase blank spaces from a twoway graph

    Dear Statalist, I would like to create a graph (twoway scatter) using the by() option for some groups. However, I only needed for some of the categories, not for all. I have tried using the "nofill" option, but it says that it s not possible. I do not understand why it uses all the groups and years since I am telling to each graph to use only for 2014 and 2017. Can you help me to erase those combinations in blank from the next graph?

    Thanks in advance for the help.

    Code:
    twoway (scatter y x if inlist(time,2014,2017) & cond==1) (lfit  y x if inlist(time,2014,2017) & cond==1), by(categ time ) scheme(s2mono)
    Click image for larger version

Name:	Graph.png
Views:	1
Size:	32.1 KB
ID:	1573291

  • #2
    Code:
    gen time2 = time if inlist(time,2014,2017)
    twoway (scatter y x if inlist(time,2014,2017) & cond==1)   ///
           (lfit    y x if inlist(time,2014,2017) & cond==1),  ///
           by(categ time2 ) scheme(s2mono)
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Dear Maarten, thanks for the solution, it worked perfectly!

      Comment


      • #4
        Just a quick question: is it possible to make bigger the groups in the "by()" option? I mean, thereafter I will combine this graph with others, and the groups (1,2014; 1,2017...) are too small in the combined graph. I have been trying with the option "size(large)" within the "by()" option but it gives error.
        Have you got any hint?

        Comment


        • #5
          Code:
          . sysuse auto, clear
          (1978 Automobile Data)
          
          . set scheme s1color
          
          . scatter mpg weight, by(foreign) subtitle(, size(large))
          
          . scatter mpg weight, by(foreign) subtitle(, size(vlarge))
          
          .. scatter mpg weight, by(foreign) subtitle(, size(huge))

          Comment


          • #6
            Dear Nick, it worked perfectly, thanks for your help.

            Comment

            Working...
            X