Announcement

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

  • How to change the range of graphs

    Hi all,

    I am trying to include only a specific range of values in my graph for my x-axis.

    Code:
    twoway (connected fidelity week if ETHNICITY==1, mcol("blue")) (connected fidelity weeks if ETHNICITY==4, mcol("purple"))
    variable
    weeks
    is the x-variable and it ranges from 10-45 but I only want to include the values from 20-40

    - I was thinking of creating a variable
    Code:
    weeks1
    that only includes
    Code:
    week
    values from 20-40 but I am not sure how to do this. Additionally, is there is perhaps an easier way to do this?


    All help is very appreciated.

    Blessing







  • #2
    Code:
     
     twoway (connected fidelity week if ETHNICITY==1 if inrange(week,20,40), mcol("blue"))   ///        (connected fidelity week if ETHNICITY==4 if inrange(week,20,40), mcol("purple"))
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Thank you very much, I will apply this code and see if it works.

      Comment


      • #4
        Sorry, the code got garbled and I did not see you already had an if condition. The correct code is:
        Code:
        twoway (connected fidelity week if ETHNICITY==1 & inrange(week,20,40), mcol("blue"))   ///        
               (connected fidelity week if ETHNICITY==4 & inrange(week,20,40), mcol("purple"))
        ---------------------------------
        Maarten L. Buis
        University of Konstanz
        Department of history and sociology
        box 40
        78457 Konstanz
        Germany
        http://www.maartenbuis.nl
        ---------------------------------

        Comment


        • #5
          Thank you very much. This worked!

          Comment

          Working...
          X