0

Here is the code I used to produce my figure:

Running_Accuracy_Across_Addition %>%
  ggplot(mapping = aes(x = Trials, y = Accuracy, group = Block, color = Block)) + 
  scale_x_discrete(name = "Trials", limits = c("First Ten", "Second Ten", "Third Ten", "Fourth Ten"), labels = c("First Ten" = "5", "Second Ten" = "15", "Third Ten" = "25", "Fourth Ten" = "35")) +
  scale_y_continuous(name = "Proportion of Correct Addition Responses Over 10 Trials", limits = c(0,1.0)) +
  geom_line() +
  geom_point(alpha = 0.5, size = 0.8) +
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_blank(), axis.line = element_line(colour = "black"), text = element_text(family="Times New Roman", size = 12)) +
  labs(title = "Change in Addition Response Accuracy As The Amount of Available Time Reduces", x = "Trials", y = "Proportion of Correct Addition Responses Over 10 Trials")

Here is an image of the figure:

enter image description here

Ronak Shah
  • 377,200
  • 20
  • 156
  • 213
Olivia
  • 1
  • 2
    As a start you could convert the Block variable to a discrete one... Also adding an example data would make it easier for others to help you (add the data in code form, not as table or image. See also [here](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610). – dario Sep 28 '21 at 10:39

1 Answers1

0

Change your grouping variable to factor like this:

df$Block <- factor(df$Block)

Example:

library(ggplot2)

# Load example data
data(iris)

# Dummy trials variable
iris$trials <- 1:nrow(iris)

When color= is numeric

# Plotting behavior for numeric groups
iris$Species_numeric <- as.numeric(iris$Species)
class(iris$Species_numeric)
#> [1] "numeric"

ggplot(data = iris) +
  geom_line(aes(trials, Petal.Length, color = Species_numeric))

enter image description here

When color= is a factor

# Plotting behavior with factor groups
iris$Species_factor <- factor(iris$Species_numeric)
class(iris$Species_factor)
#> [1] "factor"

ggplot(data = iris) +
  geom_line(aes(trials, Petal.Length, color = Species_factor))

enter image description here

Created on 2021-09-28 by the reprex package (v2.0.1)

Skaqqs
  • 4,010
  • 1
  • 7
  • 21