Announcement

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

  • How to remove the graph background line?

    Hello, Good afternoon. I would like to look for some help:
    1) I have no idea how to remove the background line? Please see my graph?
    2) How to put the graph going to the right side, because some information could not be showed?
    3) How to default the title, which locate in the middle of graph?

    Thank you very much
    I am looking forward to hearing from you

    please see my command:

    label define stu 1 "Imipenem" ///
    2 "Ertapenem" ///
    3 "Amikacin" ///
    4 "Piperacillin-tazobactam" ///
    5 "Ceftazidime" ///
    6 "Gentamicin" ///
    7 "Levofloxacin" ///
    8 "Trimethoprim-sulfaisoxazole" ///
    9 "Ceftriaxone" ///
    10 "Ciprofloxacin" ///
    11 "Cefazolin" ///
    12 "Ampicillin"

    label values study stu

    label define pred 0 "5 Tertiary care hospitals" 1 "CHINA"
    label values predicted pred

    graph hbar prevalence, over(predicted) over(study) asyvars

    generate stupred = pred if study == 1
    replace stupred = pred+3 if study == 2
    replace stupred = pred+6 if study == 3
    replace stupred = pred+9 if study == 4
    replace stupred = pred+12 if study == 5
    replace stupred = pred+15 if study == 6
    replace stupred = pred+18 if study == 7
    replace stupred = pred+21 if study == 8
    replace stupred = pred+24 if study == 9
    replace stupred = pred+27 if study == 10
    replace stupred = pred+30 if study == 11
    replace stupred = pred+33 if study == 12

    sort stupred
    list stupred study predicted, sepby(study)

    twoway (bar prevalence stupred if predicted==0, horizontal col(gray)) ///
    (bar prevalence stupred if predicted==1, horizontal col(lightgreen)) ///
    (rcap ciu cil stupred, horizontal), ///
    ytitle("") ///
    legend(label(1 "5 Tertiary care hospitals") label(2 "CHI") label(3 "95% confidence interval")) ///
    ylabel(0.5 "Imipenem" 3.5 "Ertapenem" 6.5 "Amikacin" ///
    9.5 "Piperacillin-tazobactam" 12.5 "Ceftazidime" 15.5 "Gentamicin" 18.5 "Levofloxacin" ///
    21.5 "Trimethoprim-sulfaisoxazole" 24.5 "Ceftriaxone" 27.5 "Ciprofloxacin" ///
    30.5 "Cefazolin" 33.5 "Ampicillin", angle(0)) ///
    title("Proportion of Escherichia coli resistance to antimicrobial agents",size(Medium))
    Attached Files
    Last edited by Qi Anna; 05 May 2019, 03:41.

  • #2
    Try adding - nogrid - option to ylabel.
    Best regards,

    Marcos

    Comment


    • #3
      You need to consider splitting some text labels and/or making text sizes a little smaller.

      Code:
      yla(, noticks)
      would claw back a little space.

      Comment


      • #4
        Thank you very much.

        Comment


        • #5
          On a different level: the bars make point estimates and confidence intervals harder to see. With many of these drugs whether the proportion is really not zero is not at all an issue. So just use scatter not twoway bar.

          If you give a data example with

          Code:
          dataex prevalence stupred predicted ciu cil
          then we can show you how.


          Comment


          • #6
            Thanks Nick. But I dont really understand your suggestions. Could you please more specifically? Thanks

            Comment


            • #7
              #7 Sorry, but I don't understand what you don't understand. A more specific answer would be allowed by a full data example, not yet to hand. See FAQ Advice #12.

              Comment


              • #8
                Thanks. Nick. I will take a look.

                Comment

                Working...
                X