I am having trouble removing the white lines between tiles in my heat map. Below is my code and picture. Has anyone encountered this before?
t <- ggplot(Drug_heatmap_df_final,
aes(x=reorder(Drug,Total_Deaths), y=Start_Date, fill=Total_Deaths)) +
geom_tile() +
labs(title="Heatmap of Total Deaths per month by Drug", x="Drug", y="Month") +
theme(plot.title = element_text(hjust=.5)) +
scale_y_date(date_breaks="1 year" , labels = date_format("%b-%Y")) +
theme(axis.text.x = element_text(size=13))
plot(t)
I don't know if this is the most elegant solution but if you add
color
in youraes
and then play with the size ingeom_tile
you can get them to overlap and remove the white lines:First is how my data looks with the white lines:
Now I set my color to the same object as my fill and mess with the size:
Like I said, probably not the most elegant solution, and there is probably a better, more efficient way to determine the size value (instead of trial and error like I did) but in general this seems to solve your issue.