I am trying to visualize a change in serum concentration of a certain protein over a time-period of 6 days. I am able to very easily obtain the bar graph I would like, however, the journal I am trying to publish in requires individual data points included in any type of graph.
I am able to do this as well by adding a geom_point plot, however, when I try to assign each point a certain shape based on the cellular line the data point comes from (also required), my points end up sorting in a particular order.
Here is my current code for the figure:
ggplot(table6, aes(x = Location, y = Ave, fill = Treatment)) +
geom_col(position = "dodge", color = "black", size = 1) +
facet_wrap(~ Time) +
scale_fill_brewer(palette = "Oranges") +
geom_point(aes(y = Conc, x = Location), position = position_dodge(0.9)) +
geom_errorbar(aes(ymin = Ave, ymax = Ave+SD), width = .3,
size = 1.0, position=position_dodge(.9)) +
labs(title = "Concentration of ANG in Media of Complement Treated iRPE", x = "" , y = "ANG conc. (pg)") +
theme_classic() +
theme(axis.text = element_text(size=12),
plot.title = element_text(hjust = 0.5, size = 18, face = "bold"),
strip.text.x = element_text(size = 16, face = "bold"))
Before
Now, when I try to assign a shape to the individual points this is what happens:
ggplot(table6, aes(x = Location, y = Ave, fill = Treatment)) +
geom_col(position = "dodge", color = "black", size = 1) +
facet_wrap(~ Time) +
scale_fill_brewer(palette = "Oranges") +
geom_point(aes(y = Conc, x = Location, shape = Line), position = position_dodge(0.9)) +
geom_errorbar(aes(ymin = Ave, ymax = Ave+SD), width = .3,
size = 1.0, position=position_dodge(.9)) +
labs(title = "Title", x = "" , y = "ANG conc. (pg)") +
theme_classic() +
theme(axis.text = element_text(size=12),
plot.title = element_text(hjust = 0.5, size = 18, face = "bold"),
strip.text.x = element_text(size = 16, face = "bold"))
After