Description
Hello,
Apologies if this is not the right place for this issue - it's possibly got more to do with ComplexHeatmap than tidyHeatmap - but I'm having some trouble with column labels.
I have a data frame of measurements from 9 different methods. The measurements were taken in three separate batches of 8 sample and some samples are duplicated across batches. I've made a mock dataframe with the same dimensions where in batch 1 all values are 1, batch 2 all values are 0.75 and batch 3 all values are 0.5
I want to make a heatmap where the rows are the methods, the columns are the samples, and the data is grouped by batch. Because there are some duplicated sample/method combinations I've had to create a new column in the dataframe, sample_x_batch, which appends the batch number to the sample name. If I use this code then the figure looks basically exactly as I want:
df %>% group_by(batch) %>% heatmap(.row = method, .column = sample_x_batch, .value = value, column_title = "", cluster_rows = FALSE, cluster_columns = FALSE)
However, I'd like to use the sample names as the column labels instead of sample_x_batch. I thought I could do this by adding a column_labels
argument in to the heatmap function, but it doesn't put the labels on the right columns, e.g.
I've tried also using the column_order
argument, but this only presents things in the correct order if I don't use group_by = batch
.
Is there a way to assign the labels directly from the dataframe or a better way to control where they are placed on the heatmap?