-
Beta Was this translation helpful? Give feedback.
      
      
          Answered by
          
            mbostock
          
      
      
        Apr 23, 2025 
      
    
    Replies: 1 comment 2 replies
-
| 
         You need to do a couple things differently: 
 Here is a fixed version adapted from the documentation: Plot.plot({
  color: { legend: true },
  x: { domain: [0, w] },
  y: { domain: [0, h] },
  marks: [
    Plot.raster(
      { length: w * h },
      {
        width: w,
        height: h,
        x: (_, i) => (i % w) + 0.5,
        y: (_, i) => Math.floor(i / w) + 0.5,
        fill: (_, i) => data[i],
        imageRendering: "pixelated",
        interpolate: "none",
        tip: true
      }
    )
  ]
}) | 
  
Beta Was this translation helpful? Give feedback.
                  
                    2 replies
                  
                
            
      Answer selected by
        yurivish
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    

You need to do a couple things differently:
Here is a fixed version adapted from the documentation: