Announcement

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

  • "copying" and erasing the x-axis

    I am trying to bring the x-axis at the 0 level.
    I managed to have a horizontal line at the 0 level using the option
    Code:
     yline(0, lcolor(black))
    I would like to make it have exactly the same format as the real x-axis and then erase the x-axis. Does anyone know how to do so?
    Many thanks



    Click image for larger version

Name:	graf_avcp_percap_pri.png
Views:	1
Size:	46.6 KB
ID:	1446824

    Code:
    graph bar avcp_percap_pri1 avcp_percap_pri2 avcp_percap_pri3 avcp_percap_pri4 ///
    avcp_percap_pri5 avcp_percap_pri6 avcp_percap_pri7 avcp_percap_pri8 ///
    avcp_percap_pri9 avcp_percap_pri10 avcp_percap_pri11 if selection==1, nofill ///
    over(location, label(angle(90) labsize(small)) sort(avcp_percap_pri) descending) ///
    ytitle("") yscale(off) ylab(, nogrid) ///
    blabel(total, orientation(vertical) size(small) format(%9.1f)) ///
    bar(1, bcolor(blue*1.3)) bar(2, bcolor(red*1.2)) bar(3, bcolor(black)) ///
    bar(4, bcolor(black)) bar(5, bcolor(black)) bar(6, bcolor(black)) ///
    bar(7, bcolor(black)) bar(8, bcolor(black)) bar(9, bcolor(black)) ///
    bar(10, bcolor(dkgreen)) bar(11, bcolor(dkgreen)) ///
    ysize(9) xsize(18) graphregion(color(white)) legend(off) name(graf_avcp_percap_pri,replace) ///
    yline(0, lcolor(black))

  • #2
    I tried the option below but Stata tells me xaxis1 does not exist. I do not understand the problem once I do have an x-axis. Could anyone please help me out?

    Code:
    xscale(noline)
    Entire code:
    Code:
    . graph bar av_percap_pri1 av_percap_pri2 av_percap_pri3 av_percap_pri4 ///
    > av_percap_pri5 av_percap_pri6 av_percap_pri7 av_percap_pri8 av_percap_pri9 ///
    > av_percap_pri10 av_percap_pri11  if selection==1, nofill ///
    > over(location, label(angle(90) labsize(small)) sort(av_percap_pri) descending) ///
    > ytitle("") yscale(off) ylab(, nogrid) ///
    > blabel(total, orientation(vertical) size(small) format(%9.1f)) ///
    > bar(1, bcolor(blue*1.3)) bar(2, bcolor(red*1.2)) bar(3, bcolor(black)) ///
    > bar(4, bcolor(black)) bar(5, bcolor(black)) bar(6, bcolor(black)) ///
    > bar(7, bcolor(black)) bar(8, bcolor(black)) bar(9, bcolor(black)) ///
    > bar(10, bcolor(dkgreen)) bar(11, bcolor(dkgreen)) ///
    > ysize(9) xsize(18) graphregion(color(white)) legend(off) name(graf_av_percap_pri,replace) ///
    > yline(0, lcolor(black)) xscale(noline)
    xscale(noline) not allowed, xaxis1 does not exist
    r(198);
    
    end of do-file

    Comment


    • #3
      In your graph bar command, you have a y axis and a categorical axis (not x axis). So you want

      Code:
       over(location, axis(noline) label(angle(90) labsize(small)) sort(av_percap_pri) descending)
      Apart from removing the categorical axis line, I don't see what much else you can do. The labels will stay at the same position.
      Last edited by Andrew Musau; 31 May 2018, 06:40.

      Comment

      Working...
      X