Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plot with a grid

I am looking for a type of plot that is essentially a grid. For example, there will be 10 columns and 50 rows. For example, something like this:

enter image description here

Each of the boxes (in this case, 10*50 = 500) will have a unique value that I will be providing via a data frame. Based on the unique values, I'll have a function that will assign a colour to each box. So then it becomes a grid to visualize "the range" of each box. I'd also need to label each of the columns (probably vertically so all labels fit) and rows (horizontally).

I just don't know what kind of plot that will be and I don't know if any libraries do this. I'm just looking for some help in finding something that does this. I'd appreciate some help if possible.

like image 765
intl Avatar asked Sep 24 '26 19:09

intl


1 Answers

How about heatmap?

m=matrix(runif(12),3,4)
rownames(m)=c("Me","You","Him")
colnames(m)=c("We","Us","Them","I")
heatmap(m,NA,NA)

enter image description here

Note that it works on a matrix and not a data frame because all the values have to be numbers, and data frames are row-oriented records.

See the help for other options.

like image 197
Spacedman Avatar answered Sep 26 '26 09:09

Spacedman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!