Skip to content

Commit

Permalink
v1.4 updates
Browse files Browse the repository at this point in the history
  • Loading branch information
asjadnaqvi committed Nov 8, 2022
1 parent b43b1dd commit 962ca13
Show file tree
Hide file tree
Showing 2 changed files with 235 additions and 27 deletions.
49 changes: 22 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Link to the Medium article that describes these schemes: [Stata graph schemes by

Note that scheme file options, e.g. colors, lines, sizes, etc. might be subject to minor adjustments to improve their overall visual quality.

## How to install and use SCHEMEPACK
## Install

To install SCHEMEPACK, you can either get them directly from SSC (**v1.3**):

Expand All @@ -31,7 +31,7 @@ net install schemepack, from("https://raw.githubusercontent.com/asjadnaqvi/stata

Once installed, please see `help schemepack` for the scheme descriptions and test them out.

You can also download and run the [scheme_test.do](scheme_test.do) dofile to test various graph schemes that uses this test data:
You can also download and run the [./data/scheme_test.do](scheme_test.do) dofile to test various graph schemes that uses this test data:

```
use "https://github.com/asjadnaqvi/stata-schemepack/blob/main/data/scheme_test.dta?raw=true", clear
Expand All @@ -40,34 +40,9 @@ use "https://github.com/asjadnaqvi/stata-schemepack/blob/main/data/scheme_test.d
or try them out on your own datasets! If you want to revert back to the default Stata s2 scheme, then type `set scheme s2color`. Note that you can permanently set a scheme by typing `set scheme <name>, perm`.



Please report errors or bugs or suggestions in the [Issues](https://github.com/asjadnaqvi/stata-schemepack/issues) section.



### Change log
* 08 Nov 2022: v1.4 release. Fixes and corrections to schemes. GitHub folder renamed to stata-schemepack to align it with other dataviz packages.
* 08 Sep 2022: Minor fixes for v1.3
* 14 Aug 2022: Bug fixes to schemes files. Ukraine scheme slightly desaturated. Four new schemes added: cblind1 (color-blind friendly), tab1, tab2, tab3 (qualitative colors).
* 05 Mar 2022: A new scheme based on Ukraine's flag colors.
* 15 Nov 2021: A new scheme based on Taylor Swift's Red album colors added. Minor fixes to the help file.
* 28 Oct 2021: *MAJOR UPDATE*: schemes released on SSC (`ssc install schemepack, replace`). They collection has been renamed from `tsg_schemes` to `schemepack` to make it more generic and easier to remember. Black schemes have a notch darker background (its not pure black). Bar graph outlines adjusted to make them more visible. Otherwise some schemes were blending into the background.
* 28 Jun 2021: Minor errors in templates have been fixed. For example bar labels were showing in the wrong color in the black themes. The test file has been reduced in size. The preview graphs have been regenerated. The number of graphs show in the preview below have been reduced except for the tableau schemes. All files exist in the figure folder though.
* 26 Jun 2021: Two new schemes added: neon and rainbow. Neon tests a new and more generic scheme generator script. Rainbow celebrates the 2021 Pride month and introduces the 6 pride flag colors in the schemes. This scheme is fairly limited in the sense that it only has six colors. But these are more than enough for presentations etc. This is also derived from the generic scheme template used for the Neon scheme.
* 15 Jun 2021: Schemes updated to make them compatible with Stata 15 and earlier. The s2-scheme.scheme was updated to a new version in 2019 and the older scheme version was giving errors.
* 16 Apr 2021: Very minor fixes to some colors. Histograms fixed and added to the graphs. Following schemes added: **brbg**, **piyg**, **ptol**, **jet**, **w3d**
* 08 Apr 2021: Repository created with pkg file and the following schemes added: **tableau**, **cividis**, **viridis**, **hue**

### How can you support the schemes?

You can support the schemes by using them :smirk:

You can also:

[!["Buy Me A Coffee!!!"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/asjadnaqvi)



# Preview

A preview of the schemes is given below. The latest ones are put on top. Not every scheme has been fine tuned for each and every aspect. Regardless, all elements can be modified from the graph interface window, which overwrite the scheme defaults. Some schemes are fairly robust. For example, **white_tableau** and **white_w3d** work really well and I use them most of the time. Some themes are great for presentations. For example, the dark themes on dark backgrounds, or gg schemes which keep the focus on the graph.
Expand Down Expand Up @@ -328,3 +303,23 @@ Celebrating pride (2021 edition):



### Change log
* 08 Nov 2022: v1.4 release. Fixes and corrections to schemes. GitHub folder renamed to stata-schemepack to align it with other dataviz packages.
* 08 Sep 2022: Minor fixes for v1.3
* 14 Aug 2022: Bug fixes to schemes files. Ukraine scheme slightly desaturated. Four new schemes added: cblind1 (color-blind friendly), tab1, tab2, tab3 (qualitative colors).
* 05 Mar 2022: A new scheme based on Ukraine's flag colors.
* 15 Nov 2021: A new scheme based on Taylor Swift's Red album colors added. Minor fixes to the help file.
* 28 Oct 2021: *MAJOR UPDATE*: schemes released on SSC (`ssc install schemepack, replace`). They collection has been renamed from `tsg_schemes` to `schemepack` to make it more generic and easier to remember. Black schemes have a notch darker background (its not pure black). Bar graph outlines adjusted to make them more visible. Otherwise some schemes were blending into the background.
* 28 Jun 2021: Minor errors in templates have been fixed. For example bar labels were showing in the wrong color in the black themes. The test file has been reduced in size. The preview graphs have been regenerated. The number of graphs show in the preview below have been reduced except for the tableau schemes. All files exist in the figure folder though.
* 26 Jun 2021: Two new schemes added: neon and rainbow. Neon tests a new and more generic scheme generator script. Rainbow celebrates the 2021 Pride month and introduces the 6 pride flag colors in the schemes. This scheme is fairly limited in the sense that it only has six colors. But these are more than enough for presentations etc. This is also derived from the generic scheme template used for the Neon scheme.
* 15 Jun 2021: Schemes updated to make them compatible with Stata 15 and earlier. The s2-scheme.scheme was updated to a new version in 2019 and the older scheme version was giving errors.
* 16 Apr 2021: Very minor fixes to some colors. Histograms fixed and added to the graphs. Following schemes added: **brbg**, **piyg**, **ptol**, **jet**, **w3d**
* 08 Apr 2021: Repository created with pkg file and the following schemes added: **tableau**, **cividis**, **viridis**, **hue**

### How can you support the schemes?

You can support the schemes by using them :smirk:

You can also:

[!["Buy Me A Coffee!!!"](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/asjadnaqvi)
213 changes: 213 additions & 0 deletions data/scheme_test.do
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
****************************
****************************
*** ***
*** schemepack v1.4 ***
*** ***
*** Asjad Naqvi ***
*** ***
*** The Stata Guide ***
*** on Medium ***
*** ***
*** 08 Nov 2022 ***
*** ***
****************************
****************************

* https://github.com/asjadnaqvi/stata-schemepack
* https://medium.com/the-stata-guide

// report errors here:
* https://github.com/asjadnaqvi/stata-schemepack/issues



clear

// See github page to check if there are version differences between SSC and GitHub

// install from ssc
*ssc install schemepack, replace

// OR install from GitHub
*net install schemepack, from("https://raw.githubusercontent.com/asjadnaqvi/stata-schemepack/main/installation/") replace

// read the data
use "https://github.com/asjadnaqvi/Stata-schemes/blob/main/scheme_test.dta?raw=true", clear

// you either type:
* set scheme white_tableau
* set scheme black_tableau
* set scheme gg_tableau

// or permanently set the theme
* set scheme white_tableau, perm

// or set it in a graph directly
* twoway (scatter var2 date if group==1), scheme(white_tableau)


// Feel free to try these on your own datasets and please report errors if any


set scheme white_tableau


*****************************************
*********** TEST GRAPHS BELOW ***********
*****************************************

// note that some schemes might only have only 6 or 8 color. Therefore the cycle repeats once the last defined
// color of a scheme is reached.

*** Scatter plot

twoway ///
(scatter var2 date if group==1) ///
(scatter var2 date if group==2) ///
(scatter var2 date if group==3) ///
(scatter var2 date if group==4) ///
(scatter var2 date if group==5) ///
(scatter var2 date if group==6) ///
(scatter var2 date if group==7) ///
(scatter var2 date if group==8) ///
(scatter var2 date if group==9) ///
(scatter var2 date if group==10) ///
(scatter var2 date if group==11) ///
(scatter var2 date if group==12) ///
, ///
legend(order(1 "group1" 2 "group2" 3 "group3" 4 "group4" 5 "group5" 6 "group6" 7 "group7" 8 "group8" 9 "group9" 10 "group10" 11 "group11" 12 "group12")) ///
title("Scatter plot") ///
note("By the Stata Guide")




*** Line graph

twoway ///
(line var2 date if group==1) ///
(line var2 date if group==2) ///
(line var2 date if group==3) ///
(line var2 date if group==4) ///
(line var2 date if group==5) ///
(line var2 date if group==6) ///
(line var2 date if group==7) ///
(line var2 date if group==8) ///
(line var2 date if group==9) ///
(line var2 date if group==10) ///
(line var2 date if group==11) ///
(line var2 date if group==12) ///
, ///
legend(order(1 "group1" 2 "group2" 3 "group3" 4 "group4" 5 "group5" 6 "group6" 7 "group7" 8 "group8" 9 "group9" 10 "group10" 11 "group11" 12 "group12")) ///
title("Line plot") ///
note("The Stata Guide", size(vsmall))





*** Pie chart

graph pie var2 if group <= 10, ///
over(group) plabel(_all percent, format(%9.2f)) ///
line(lcolor(black) lwidth(vvthin)) /// // outline colors have to be manually added
title("Pie plot") ///
note("The Stata Guide", size(vsmall))



*** Box plot

graph box ///
var* ///
, ///
title("Box plot") ///
note("The Stata Guide", size(vsmall))

*** Histogram

histogram var4, percent ///
title("Histogram") ///
note("The Stata Guide", size(vsmall))

*** Bar graph

graph bar ///
var* ///
, ///
blabel(bar, format(%9.2f)) ///
title("Bar graph") ///
note("The Stata Guide", size(vsmall))



*** Horizontal bar graph

graph hbar (mean) ///
var* ///
if group <= 6, ///
over(group) ///
percentages stack ///
legend(order(1 "Var 1" 2 "Var 2" 3 "Var 3" 4 "Var 4" 5 "Var 5" 6 "Var 6")) ///
title("Bar graph") ///
note("The Stata Guide", size(vsmall))


*** Confidence bands

twoway ///
(lpolyci var1 var9, fcolor(%80)) ///
(lpolyci var2 var9, fcolor(%80)) ///
(lpolyci var3 var9, fcolor(%80)) ///
, ///
title("Confidence Interval") ///
note("The Stata Guide", size(vsmall))


*** Range graphs

twoway ///
(rcapsym var2 var3 date if group==1, sort) ///
(rcapsym var2 var3 date if group==2, sort) ///
, ///
title("Range plots") ///
note("The Stata Guide", size(vsmall))


*** Area graphs

twoway ///
(area den1d den1x, fcolor(%50)) ///
(area gen2d gen2x, fcolor(%50)) ///
(area gen3d gen3x, fcolor(%50)), ///
title("Density plots") ///
note("The Stata Guide", size(vsmall))


*** Scatter labels

twoway ///
(scatter var2 var1, mlabel(group)) ///
if date==22320 ///
, ///
title("Confidence Interval") ///
note("The Stata Guide", size(vsmall))


*** By graphs

twoway ///
(scatter var2 var1) ///
if group <= 12, ///
by(group, yrescale xrescale) ///
by(, title("By graphs") note("The Stata Guide", size(vsmall)))




//// ******* END OF FILE ******* \\\\





0 comments on commit 962ca13

Please sign in to comment.