Announcement

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

  • How to increase number of discrete colors in `colordiscrete` option of `colorvar`

    Hello,
    I am drawing plot using the new colorvar() option. I am using colordiscrete as an additional option to identify my different groups. However I have over 60 different groups. and the colordiscrete palette only include around 15 discrete values. Is there a way to expand the number of discrete colors included in the palette? thanks a lot for your help

    this is a code to produce a plot
    Code:
    twoway (scatter yhat_cv y, msymbol(O) colorrule(phue) colorvar(group_name) zlabel(, valuelabel) colordiscrete coloruseplegend ) ///
           (lfit yhat_cv turnover, lcolor(red) lpattern(dash)), ///
           title("Scatter Plot of Turnover vs. yhat with Linear Fit (CV)") ///
           xtitle("y") ///
           ytitle("Predicted y") ///
           legend(off) ///
           ylabel(#5) xlabel(#10) //

  • #2
    You can use colorlist() to specify list of colors for each level of colorvar:

    Code:
    sysuse auto
    scatter mpg price, colorvar(rep78) colordiscrete coloruseplegend colorlist(green yellow blue%20 red red*0.5)

    Comment

    Working...
    X