Announcement

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

  • Error with heatmap and ColrSpace

    Hello, I am try to create a heatmap of correlations. To do so, I essentially followed Benn Jann's code on page 38. For example:

    Code:
    quietly corr hrrscale var1 var2 var3 var4
    matrix W = r(C)
    heatplot W, values(format(%9.3f)) color(hc1, diverging intensity(.6)) ///
      legend(off) aspectratio(1) lower drop(0)
    However, when I run this code, I get the following error

    Code:
    function drop() not declared in class ColrSpace
    (120 lines skipped)
    (error occurred while loading colorpalette.ado)
    r(3000);
    I am confused as to why I am getting this error as my code is identical to that of Jann's. When I search for this error online, I have trouble finding any leads. Does anyone know the source of it and how to resolve it?


  • #2
    Ben Jann Do you happen to know the source of this issue?

    Comment


    • #3
      Don't know. Maybe update all involved packages and try again.

      Code:
      ssc install heatplot, replace
      ssc install palettes, replace
      ssc install colrspace, replace
      Note that there has been a change in syntax for specifying palettes; argument diverging is now specified directly after hcl and not as an option after the comma. Example:

      Code:
      sysuse auto, clear
      quietly corr price weight mpg turn
      matrix W = r(C)
      heatplot W, values(format(%9.3f)) color(hcl diverging, intensity(.6)) ///
        legend(off) aspectratio(1) lower drop(0)
      Best,
      ben

      Comment


      • #4
        Ben Jann is it possible to make y scale starts from price to turn in the previous example?

        Comment


        • #5
          Add option yscale(noreverse):

          Code:
          sysuse auto, clear
          quietly corr price weight mpg turn
          matrix W = r(C)
          heatplot W, values(format(%9.3f)) color(hcl diverging, intensity(.6)) ///
              legend(off) aspectratio(1) lower drop(0) yscale(noreverse)
          ben

          Comment


          • #6
            Thank you Ben. I created a matrix of the cross-tab results of my data (i was not doing correlation coefficients) and flipped the matrix to make it work. However, yscale(noreverse) also worked without extra work of flipping the matrix. Thanks you once again.

            Comment

            Working...
            X