Announcement

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

  • How to remove top and right border on graph

    Hello,

    I have created a two-way scatter plot however I want to get rid of the black border that it puts around the graph on the top and right edges.

    Does anyone know code that would get rid of this?

    Thank you,
    Annabelle

  • #2
    Borders are a function of the scheme. Show us your exact scheme and commands (and preferably upload an image) to illustrate what you want to get rid of.

    Comment


    • #3
      Hello Andrew,

      This is the code I am using:


      twoway (scatter `s_type1' `s_type2' if disease_grp==0 , msymbol(circle) mcolor("`INF_grey'") mlcolor(black) mlwidth(vthin)) ///
      (scatter `s_type1' `s_type2' if disease_grp==1 , msymbol(circle) mcolor("`INF_gold'") mlcolor(black) mlwidth(vthin)) ///
      (scatter `s_type1' `s_type2' if disease_grp==2 , msymbol(circle) mcolor("`INF_Red'") mlcolor(black) mlwidth(vthin)) ///
      (function y=x , range(``obj'`analyte'y') lcolor(midblue)), ///
      legend(off) ytitle("`s_type1'") xtitle("`s_type2'") ///
      xlabel(``obj'`analyte'xlab') xscale(range(``obj'`analyte'x')) ///
      ylabel(``obj'`analyte'ylab') xscale(range(``obj'`analyte'y')) ///
      aspectratio(1) ///

      And this is the graph it produces:
      Click image for larger version

Name:	NfLCap_P_0_NfLCap_P_0_Scat.png
Views:	1
Size:	62.1 KB
ID:	1713118



      I would like to remove the black border on the right and on the top.

      Comment


      • #4
        to find out what scheme you are using, type
        Code:
        query graphics
        then post the result within a CODE block

        Comment


        • #5
          This is the results:

          . query graphics
          ------------------------------------------------------------------------
          Graphics settings
          set graphics on
          set scheme s1color
          set printcolor asis may be automatic, asis, gs1, gs2,
          > gs3
          set copycolor asis may be automatic, asis, gs1, gs2,
          > gs3
          set maxbezierpath 0 bezier path elements

          Comment


          • #6
            You can use the graph editor. With the command gr_edit:

            Code:
            sysuse auto, clear
            set scheme s1color
            scatter mpg weight
            scatter mpg weight
            gr_edit .plotregion1.style.editstyle boxstyle(linestyle(color(none))) editcopy
            Click image for larger version

Name:	Graph.png
Views:	1
Size:	32.4 KB
ID:	1713157

            Comment


            • #7
              This works! Thank you!

              Just for future reference, how do I type code in a code box?

              Comment


              • #8
                Click on the hash button (#) in the Advanced Editor. This will create CODE delimiters and you write code within the delimiters.

                Comment


                • #9
                  In Stata 18 this choice is now the default.

                  Comment

                  Working...
                  X