Announcement

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

  • option nofill in a twoway bar

    Hi averyone,

    I am having a problem using nofill in a twoway bar. I need it because in my loop there are some Secretaries that didnt choose all the options in my survay.

    when I use a grapgh bar I can use de nofill

    graph bar if Secretaria=="MEDELLIN", nofill showyvars yvaroptions(label(labsize(small)) axis(lcolor(ltblue))) bar(1, fcolor(gold%70) lcolor(black)) yscale(lcolor(emerald%50) lwidth(vvvthin) lpattern(dot)) ymtick(, labels labsize(small)) title(MEDELLIN, size(vsmall)) note(Dimen, size(vsmall)) legend(off)

    BUT when I use the twoway it doesnt let me and I need it

    splitvallabels pregunta
    twoway (bar q1_ pregunta if Secretaria=="MEDELLIN", nofill fcolor(gold%70) lcolor(gold) barwidth(0.7)) ///
    (rcap uboundq1_ lboundq1_ pregunta if Secretaria=="MEDELLIN", lcolor(black%70) ) ///
    , xlabel(`r(relabel)', labsize(small)) ylabel(, angle(horizontal)) xtitle("") ytitle("Porcentaje") title("Existe", size(msmall) color(black)) subtitle("MEDELLIN", size(small) color(black)) graphregion(fcolor(white)) legend(off)


    Let me know if you know an option to nofill in a twoway bar




  • #2
    The -nofill- option of graph bar omits the display of empty categories. Are you sure you ran exactly the following command for the twoway graph?

    twoway (bar q1_ pregunta if Secretaria=="MEDELLIN", nofill fcolor(gold%70) lcolor(gold) barwidth(0.7))
    twoway bar expects 2 variables and I would be surprised if you did not get a syntax error including only one variable. Anyway, to answer your question generally, -nofill- is not needed for twoway graphs as such empty categories will be missing values in the continuous variables, and you have control over these when setting up your data prior to graphing.
    Last edited by Andrew Musau; 20 Aug 2020, 15:47.

    Comment


    • #3
      Thank you, I didnt know that. But look the graph. It still appears. I think is because I am using the splitvallabels command.

      I dont Know, let me know what you thing


      splitvallabels q1
      twoway (bar q1_ q1 if Secretaria=="med", fcolor(gold%70) lcolor(gold) barwidth(0.7)) ///
      (rcap uboundq1_ lboundq1_ q1 if Secretaria=="med", lcolor(black%70) ) ///
      , xlabel(`r(relabel)', labsize(small)) ylabel(#7, angle(horizontal) format(%6.2f)) xtitle("") ytitle("Porcentaje") title("bla bla bla", size(msmall) color(black)) subtitle("med", size(small) color(black)) graphregion(fcolor(white)) legend(off)




      Click image for larger version

Name:	borrarr.png
Views:	1
Size:	11.3 KB
ID:	1569871

      Comment


      • #4
        As I understand #3 you're asking for all value labels to be shown as x axis labels, and that happens. Whether the corresponding bars are there but of zero height but not there because no such observations meet your criteria is neither here nor there. As Andrew Musau points out nofill is an option that applies to graph bar but not twoway bar. if you don't want to see those gaps, don't ask to see the corresponding labels.

        Comment


        • #5
          Thank you, I understand now

          Comment

          Working...
          X