0
$\begingroup$

how to draw the grayscale arrays using the ArrayPlot command of a square of the size of 40 by 40 pixel, with the values of 100.

ArrayPlot[Table[100, {x, 40}, {y, 40}], Mesh -> True, 
PixelConstrained -> {40, 40}]

I am using the above code but I am not seeing a change in the gray scale for 0.1 or any other values except 0.

And I also want to change the values in each line from 1 to 40. So, I can see the change in grayscale.

$\endgroup$
3
  • 1
    $\begingroup$ Something like ArrayPlot[ConstantArray[Subdivide[39], 40]]? (For comparison, look at Image[ConstantArray[Subdivide[39], 40]].) $\endgroup$ – J. M.'s ennui Feb 18 at 13:05
  • 2
    $\begingroup$ ArrayPlot uses the value you specified to color that cell. Table[100, {x, 40}, {y, 40}] will generate a matrix which all of its value is 100, so you should not see any changes. $\endgroup$ – Beny Izd Feb 18 at 13:09
  • 1
    $\begingroup$ Perhaps ArrayPlot[Table[0.8, {x, 40}, {y, 40}], Mesh -> True, PixelConstrained -> {40, 40}, ColorFunctionScaling -> False, ColorFunction -> GrayLevel] or ArrayPlot[Table[0.8, {x, 40}, {y, 40}], Mesh -> True, PixelConstrained -> {40, 40}, ColorFunctionScaling -> False, ColorFunction -> (GrayLevel[1-#]&)] $\endgroup$ – Michael E2 Feb 18 at 14:38
3
$\begingroup$

Is this what you want?

t = Table[x y, {x, 40}, {y, 40}];
ArrayPlot[t]

enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.