I want to rearrange the bars in the following graph. i want to show CT and HS bars side by side , for example first 1DAS CT and HS bar then 15DAS CT and HS bar and so on. I am using the following code
<code>ggplot(data, aes(x = Genotype, y = Pn, fill = DAS)) +
geom_col_pattern(aes(pattern = Treatment), pattern_color = '#00000050',
position = position_dodge(0.7), width = 0.5,
color = 'gray50',
pattern_angle = 45, pattern_spacing = 0.02) +
scale_pattern_manual(values = c('none', 'stripe'),
guide = guide_legend(override.aes = list(fill = 'white'))
) +
scale_fill_brewer('Species', palette = 'Pastel2',
guide = guide_legend(override.aes = list(pattern = 'none'))
) +
theme_minimal(base_size = 16) +
theme(axis.text.x.bottom = element_text(face = "bold"),
panel.spacing.x = unit(0, 'mm'),
panel.grid.major.x = element_blank(),
axis.text.x = element_text(angle=90))
</code>
<code>ggplot(data, aes(x = Genotype, y = Pn, fill = DAS)) +
geom_col_pattern(aes(pattern = Treatment), pattern_color = '#00000050',
position = position_dodge(0.7), width = 0.5,
color = 'gray50',
pattern_angle = 45, pattern_spacing = 0.02) +
scale_pattern_manual(values = c('none', 'stripe'),
guide = guide_legend(override.aes = list(fill = 'white'))
) +
scale_fill_brewer('Species', palette = 'Pastel2',
guide = guide_legend(override.aes = list(pattern = 'none'))
) +
theme_minimal(base_size = 16) +
theme(axis.text.x.bottom = element_text(face = "bold"),
panel.spacing.x = unit(0, 'mm'),
panel.grid.major.x = element_blank(),
axis.text.x = element_text(angle=90))
</code>
ggplot(data, aes(x = Genotype, y = Pn, fill = DAS)) +
geom_col_pattern(aes(pattern = Treatment), pattern_color = '#00000050',
position = position_dodge(0.7), width = 0.5,
color = 'gray50',
pattern_angle = 45, pattern_spacing = 0.02) +
scale_pattern_manual(values = c('none', 'stripe'),
guide = guide_legend(override.aes = list(fill = 'white'))
) +
scale_fill_brewer('Species', palette = 'Pastel2',
guide = guide_legend(override.aes = list(pattern = 'none'))
) +
theme_minimal(base_size = 16) +
theme(axis.text.x.bottom = element_text(face = "bold"),
panel.spacing.x = unit(0, 'mm'),
panel.grid.major.x = element_blank(),
axis.text.x = element_text(angle=90))
and i got this graph in which for each genotype first it showed CT bars and then for HS bars.