Hi all,
Thanks to Kit Baum, a new programme -colorscatter- is available for download from SSC. -colorscatter- draws (twoway) scatterplots allowing to vary the marker color by a third varaible.
The package can be installed using:
The program works by merging many normal twoway scatter plots with varying parameters.
The following code is an example application using all available options:
Thanks to Kit Baum, a new programme -colorscatter- is available for download from SSC. -colorscatter- draws (twoway) scatterplots allowing to vary the marker color by a third varaible.
The package can be installed using:
Code:
ssc install colorscatter
The following code is an example application using all available options:
Code:
set obs 1000 gen x = rnormal() gen y = rnormal() gen c = min(abs(x),abs(y)) colorscatter x y c, scatter_options(msymb(Oh)) /// This is passed to twoway scatter to draw circles as markers rgb_low(255 0 0) rgb_high(0 255 0) /// This specifies the colors for low and for high values of c cmax(1.5) cmin(0.5) /// This specifies the lowest and highest values for the color gradient. lower and higher values of c wil all yield the same color. keeplegend /// By default colorscatter creates a custom legend, if the users want to specify their own legend this needs to be specified legend(order(2 "c = lowest " 150 "c = highest") pos(2) col(1)) /// This draws a new legend title("Twowaytitle") /// Any option which colorscatter does not know is simply passed on to twoway. Hence twoway options can be specified as usual
Comment