Paul Paul - 1 year ago 109
R Question

Converting a matrix into a gray scale image in R

I have the following vector:


And would like to reshape it into a matrix of the form 33 X 28. Then convert the matrix into a gray scale pixel like image.

In MATLAB, I know there exists imagesc and imshow to convert the matrix into an image. Is there something similar in R ?

Also, can the mean and maximum be adjusted like in MATLAB for the gray scale intensity?

Answer Source

You are looking for ?heatmap:



You can adjust the min/max color via the col argument. Look at ?image, ?heat.colors and friends.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download