Geom_tile isn't plotting every row

So I'm trying to create a heatmap for the data below:

> dput(dat.ctsig)
structure(list(protein = c("60S ribosomal protein_19", "Aquaporin", 
"Uncharacterized Protein_582", "60S ribosomal protein_19", "Aquaporin", 
"Uncharacterized Protein_582", "60S ribosomal protein_19", "Aquaporin", 
"Uncharacterized Protein_582", "60S ribosomal protein_19", "Aquaporin", 
"Uncharacterized Protein_582", "60S ribosomal protein_19", "Aquaporin", 
"Uncharacterized Protein_582", "ERBB-3 binding protein", "Expansin-B1", 
"Profilin", "Uncharacterized Protein_497", "ERBB-3 binding protein", 
"Expansin-B1", "Profilin", "Uncharacterized Protein_497", "ERBB-3 binding protein", 
"Expansin-B1", "Profilin", "Uncharacterized Protein_497", "ERBB-3 binding protein", 
"Expansin-B1", "Profilin", "Uncharacterized Protein_497", "ERBB-3 binding protein", 
"Expansin-B1", "Profilin", "Uncharacterized Protein_497"), variable = structure(c(1L, 
1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 4L, 5L, 5L, 5L, 1L, 1L, 
1L, 1L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 5L, 5L, 
5L, 5L), levels = c("Initial Biomass", "Anaerobic_24 hr", "Anaerobic_28 day", 
"Citric_24 hr", "Citric_28 day"), class = "factor"), value = c(-0.00515, 
-0.00175, 0.03745, -1.42345, -1.01685, 1.73375, 0.2432, 0.1053, 
-0.8541, -0.49655, 0.3397, -0.31055, -1.23205, -1.0944, -2.49855, 
-0.00105, 0.00175, -0.0545, 0.000800001, -0.5241, 0.04915, 0.2492, 
0.3146, -0.2117, 0.13525, -0.2752, 0.50025, -0.2766, 0.2583, 
-0.1342, 0.23675, 1.09865, 1.33995, 1.112, 1.5369)), row.names = c(NA, 
-35L), class = "data.frame")

But for some reason, not all of the 35 data points/rows are appearing ont he graph and I'm not sure why. I'm using the following command:

ggplot(dat.ctsig,aes(x=variable,y=protein,fill=value))+
  geom_tile(color='black')+
  scale_fill_gradient2(limits=c(-3,3),low='red',mid='white',
                       high='cyan4')+
  # coord_fixed(ratio=0.2)+
  guides(fill=guide_colorbar(title='Log2\nFold Change'))+
  theme(text=element_text(size=18),axis.text=element_text(size=16),
        axis.text.x=element_text(angle=90,vjust=0.5),
        axis.title=element_blank(),plot.title=element_text(size=18,hjust=0.5))+
  labs(title="CA two-fold changed over UT")+
  geom_text(aes(label=round(value,1)))

There should be 35 rows, but it's only plotting 7 for some reason. Any insight would be greatly appreciated.

The 35 data points correspond to the 35 tiles in the heatmap (7 rows x 5 columns).

Oh my gosh, you're right. Thank you. Don't know why this escaped me.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.