Announcement

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

  • removing common Y-axis texts for catplot

    Hi, I want to remove the y-axis texts (Number of hours and Sex) for the right-hand column:

    Here is the code:
    catplot Sex Sleep , by (Education) var1opts(sort(1)) percent blabel(bar, format(%4.1f)) ysize(3) yla(none) ysc(noline) plotregion(lcolor(white)) ytitle(Hours of sleep (Day & Night combined))


    Please let me know if there is a way to edit these items. Thanks in advance.
    Click image for larger version

Name:	fig.JPG
Views:	1
Size:	226.2 KB
ID:	1465789

    Last edited by Sonnen Blume; 13 Oct 2018, 19:22.

  • #2
    Please read and follow FAQ Advice #12 https://www.statalist.org/forums/help#stata on explaining community-contributed commands and giving data examples. You could try

    Code:
    by (Education, col(1))
    or

    Code:
    by (Education, row(1))
    but you might not like the results. Alternatively, permute the categorical variables so that another variable (likely Sex) is fed to by().

    Comment


    • #3
      Originally posted by Nick Cox View Post
      Please read and follow FAQ Advice #12 https://www.statalist.org/forums/help#stata on explaining community-contributed commands and giving data examples. You could try

      Code:
      by (Education, col(1))
      or

      Code:
      by (Education, row(1))
      but you might not like the results. Alternatively, permute the categorical variables so that another variable (likely Sex) is fed to by().
      Thanks Professor. I am using Stata 14, ssc package catplot.

      What you mentioned (by education(row, 1)) is a good strategy to bring the different parts in the same row. However the y-axes are still there for each of the components, I just want to keep the first one and delete the marked ones :
      Click image for larger version

Name:	stata1.JPG
Views:	1
Size:	199.7 KB
ID:	1465858

      Last edited by Sonnen Blume; 14 Oct 2018, 14:00.

      Comment


      • #4
        As in #2 we still need a data example.

        You could do this

        Code:
        contract   Sex Sleep  Education
        dataex
        to show everyone what you are working with. FAQ Advice #12 applies.

        Comment


        • #5
          Absent an example, this one may still help. I switched to tabplot (Stata Journal) as I couldn't find a solution either.


          Code:
          webuse nlswork, clear
          set scheme s1color 
          
          label def yesno 0 no 1 yes 
          label val union yesno 
          label var union "Union?"
          label val c_city yesno 
          label var c_city "Central city?" 
          
          tabplot race union, by(c_city, note("") t1title("`: var label c_city'")) percent showval
          Click image for larger version

Name:	whatevertabplot.png
Views:	1
Size:	17.8 KB
ID:	1465976

          Comment


          • #6
            Originally posted by Nick Cox View Post
            Absent an example, this one may still help. I switched to tabplot (Stata Journal) as I couldn't find a solution either.


            Code:
            webuse nlswork, clear
            set scheme s1color
            
            label def yesno 0 no 1 yes
            label val union yesno
            label var union "Union?"
            label val c_city yesno
            label var c_city "Central city?"
            
            tabplot race union, by(c_city, note("") t1title("`: var label c_city'")) percent showval
            [ATTACH=CONFIG]n1465976[/ATTACH]
            Excellent chart! I am also switching to tabplot.

            Comment

            Working...
            X