Announcement

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

  • Changing the plotregion margin in a scheme

    Greetings!
    I am using Stata 18 on Windows. I'm trying to write a scheme in which the top plotregion margin is set to 0. Looking through the documentation, in help scheme graph twoway, it indicates that the plotregion margin for twoway graphs can be specified with:

    margin plotregion marginstyle

    Where marginstyle can be specified in many ways, for instance "zero" sets all margins to 0 and "t=0" sets the top margin to 0. However, this doesn't seem to work for me. I include a MWE below:

    test.scheme
    Code:
      
        #include s2color
        color background  blue
        margin  plotregion  t=0
    I then save the scheme and try to test it as follows:

    Code:
    clear all
    
    set scheme test
    
    sysuse auto
    
    twoway scatter mpg price
    
    twoway scatter mpg price, plotregion(margin(t=0))
    The first twoway graph does reflect the change in background color but not the change in the plotregion margin:

    Click image for larger version

Name:	test_graph.png
Views:	1
Size:	27.5 KB
ID:	1762964




    And only when manually entering the option plotregion(margin(t=0)) does it work:

    Click image for larger version

Name:	test2_graph.png
Views:	1
Size:	27.7 KB
ID:	1762965



    I have also tried using other specifications for marginstyle to test if that was the problem, but to no avail. I tried using margin plotregion 0, margin plotregion zero and margin plotregion 0 0 0 0, but none work.

    Thanks for the help.
    Last edited by Pablo Derbez; 03 Sep 2024, 12:20.
Working...
X