Hi All,
I have a dichotomised variable, which I have split into two variables in an endeavour to show the distribution of zeros and ones with this dichotomised variable.
I've been mildly successful. Yet, the graph I've produced has 0.0, 0.5, 1.0 as tick marks on the x-axis, when I simply want 0-1 as tick marks.
Thus far, I've tried establishing 'limits' 'breaks' and all kinds of customisation on the x-axis, yet with very limited success.
I've tried to upload some data and my code for a a reproducible example. Would appreciate if anyone could help me amend the issue.
The data is unequal length, so I've used 'melt' to combine 0-1s.
C1
[1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
[62] 1 1 1 1 1 1 1 1 1
C11
[1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
maxlength = max(length(C1), length(C11))
CELL1 = c(C1, rep(NA, maxlength - length(C1)))
CELL11 = c(C11, rep(NA, maxlength - length(C11)))
CELL1 <- as.numeric(CELL1)
CELL11 <- as.numeric(CELL11)
CELL111 <- data.frame(CELL1, CELL11)
CELL111 <- melt(CELL111)
CC1 <- ggplot(CELL111, aes(x=value, fill=variable)) +
geom_histogram(binwidth = 0.5, bins = 2) +
theme_classic() +
labs(title = "Cell 3 \n (Cluster 1)") +
theme(legend.position = "none", plot.title = element_text(hjust = 0.5, size = 11, face = "bold"),
axis.text = element_text(size = 11)) +
xlab("mRs") +
scale_fill_manual(values = c("#80B1D3", "#FB8072"))
Would appreciate any help here 