Re #75: You could misuse heatplot for that (from SSC; also requires palettes and colrspace from SSC). Here is an example in which opacity and size of markers is proportional to a variable in the data.
Options discrete stat(asis) scatter make heatplot behave like a regular scatter command (i.e. no binning or aggregation of data, use marker symbols instead of color fields).
Option size(displ^2) makes sizes of marker symbols proportional to the square of variable displ. This is equivalent to specifying [aw=displ^2] in twoway scatter.
Option colors(cyan, opacity(20(2)80)) specifies to use a cyan color gradient with opacity values between 20% and 80% (in steps of 2) based on the values of variable displ (if three variables are specified in heatplot, the first variable will be used for the color gradient).
Here is a second example with a gradient from grey to magenta.
The ipolate() suboption determines how the colors are interpolated; default settings are used here, but the option is quite powerfull; have a look at help colorpalette for details. You can also interpolate across more than two colors.
Code:
sysuse auto heatplot displ price weight, discrete stat(asis) scatter size(displ^2) colors(cyan, opacity(20(2)80)) p(mlc(black)) legend(off)
Options discrete stat(asis) scatter make heatplot behave like a regular scatter command (i.e. no binning or aggregation of data, use marker symbols instead of color fields).
Option size(displ^2) makes sizes of marker symbols proportional to the square of variable displ. This is equivalent to specifying [aw=displ^2] in twoway scatter.
Option colors(cyan, opacity(20(2)80)) specifies to use a cyan color gradient with opacity values between 20% and 80% (in steps of 2) based on the values of variable displ (if three variables are specified in heatplot, the first variable will be used for the color gradient).
Here is a second example with a gradient from grey to magenta.
Code:
heatplot displ price weight, discrete stat(asis) scatter size(displ^2) colors(gs10 magenta, opacity(50) ipolate(20)) p(mlc(black)) legend(off)
The ipolate() suboption determines how the colors are interpolated; default settings are used here, but the option is quite powerfull; have a look at help colorpalette for details. You can also interpolate across more than two colors.
Comment