user3864435
user3864435

Reputation: 15

Alter Stata graphing scheme

From a panel data set I am graphing time series for a high number of countries, by country.

For each country, the graph code is as follows:

twoway (tsline spread if Cntry == 1) (tsline bidask if Cntry == 1, yaxis(3)) (tsline debt if Cntry == 1, yaxis(2) name(country1) title(Austria))

I need to alter several features of the graphs, such as

Instead of altering the code for each of my ids, is there a way to modify an official Stata scheme directly?

Upvotes: 1

Views: 3265

Answers (2)

Billy Buchanan
Billy Buchanan

Reputation: 51

You may also be interested in using the brewscheme package to generate scheme files that are customized to your more specific needs:

net inst brewscheme, from("http://wbuchanan.github.io/brewscheme") replace

In addition to helping you to specify a fully customized scheme file, the most current version of the program will also generate equivalent versions of the scheme that simulate how the graph would be perceived by individuals with different forms of color sight impairments an example using a scheme file I created with the package to simulate the appearance of graphs created by the ggplot2 package of R can be found at http://wbuchanan.github.io/brewscheme/brewproof/. The package also includes programs that help you to create named color styles that you can use in Stata, to generate new color palettes for use with the program, etc... In a way it is more like a toolkit for Stata graph aesthetics.

Upvotes: 1

Roberto Ferrer
Roberto Ferrer

Reputation: 11102

I'll try to show how you can go about creating your own scheme. This does not imply however, that a personalized scheme is the only solution to your problem. There may be other, more direct ways of handling that. Moreover, this is how I have done it in the past, so better ways should be possible.

  1. Install a user-written scheme. This will be saved in your ado/plus directory (use sysdir to check where Stata system directories point to). One such scheme can be obtained running

    net install gr0002_3, from(http://www.stata-journal.com/software/sj4-3)
    

    This will install the lean1 and lean2 schemes, by Svend Juul.

  2. Open up the file that defines one of these schemes. Run, for example:

    viewsource scheme-lean2.scheme
    
  3. Open up a built-in scheme using

    viewsource scheme-s2mono.scheme
    

    (This shows that schemes are named as scheme-<somename>.scheme.)

  4. Inspect and compare. Noticeably, the use of #include <someotherscheme> allows us to make modifications based on previous, tested schemes.

  5. Make use of these examples to write your own scheme. Many configurable options are described in the manual entries [G-3] Options and [G-4] Styles, concepts, and schemes. Use that also.

The source files may be overwhelming, but if you run

viewsource scheme-lean1.scheme

you can see that the strategy of using #include can make up for what seems to be tedious programming. Your personalized scheme can be as simple as required.

Upvotes: 3

Related Questions