Announcement

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

  • Problem applying scheme to graph file

    I create and save two graphs. In one of them, I change the size of the x-labels to large.

    Code:
    sysuse auto
    
    twoway scatter mpg price, scheme(s2color) name(defaults)
    graph save defs, replace
    
    twoway scatter mpg price, scheme(s2color) xlabel(,labsize(large)) name(modified)
    graph save mod, replace
    The graphs are as I expected. One graph has the larger x-labels.
    Click image for larger version

Name:	defaults.png
Views:	4
Size:	43.9 KB
ID:	1769206 Click image for larger version

Name:	modified.png
Views:	3
Size:	46.1 KB
ID:	1769208

    Next, I load the gph files and apply a new scheme. This scheme changes the x-label size.

    The scheme file:
    Code:
    #include stcolor
    
    gsize  tick_label 1
    The do file:
    Code:
    clear all
    
    graph use defs, scheme(test)
    graph use mod, scheme(test)
    The output from the figure created without modification has the x-label size correctly applied from the scheme. The figure created with a modified x-label size does not have the scheme-defined x-label size. It otherwise seems to apply the scheme elements.

    Am I doing something wrong? Have I misread the purpose and use of these commands? Thank you for your help.

    Click image for larger version

Name:	def2.png
Views:	2
Size:	34.6 KB
ID:	1769210 Click image for larger version

Name:	mod2.png
Views:	2
Size:	39.3 KB
ID:	1769212
    Attached Files

  • #2
    You applied the scheme "test", but xlabel(,labsize(large)) took precedence. The scheme provides default options, but doesn't override explicitly set options. The "test" scheme was applied later, but later doesn't imply precedence.

    The code
    Code:
    graph use mod, scheme(test)
    Is effectively the same as
    Code:
    twoway scatter mpg price, scheme(test) xlabel(,labsize(large))
    One solution: you could make a graph recording to modify the xlabel size, and then use -graph use mod, scheme(test) play(recording)-.

    Comment


    • #3
      Nils, thank you for the clarification.

      Comment

      Working...
      X