Please find my code below (I did not place the updated code for each image here.) The Code below is for the image labeled original :
packages <- c("ggplot2", "dplyr", "quantreg", "officer","tidyverse","here","glue","rvg","viridis","scales")
install.packages(setdiff(packages, rownames(installed.packages())))
lapply(packages, require, character.only = TRUE)
data <- read.csv(file='Spiderplot_data.csv', header=TRUE)
Progressed <- as.factor(data$Progression)
Response <- as.factor(data$X)
Response <- factor(data$X, levels = c("Progressive Disease", "Stable Disease", "Partial Response", "Complete Response"))
highlight_df <- filter(data, Progression == 1)
p <- ggplot() +
geom_line(
data,
mapping = aes(
x = Cycle,
y = Change,
group = Study_ID,
color = Response
)
) +
geom_point(
data,
mapping = aes(
x = Cycle,
y = Change,
group = Study_ID,
color = Response,
shape = Progressed
)
) +
geom_point( # Data set with just points
highlight_df,
shape = 18,
size = 2.8,
mapping = aes(
x = Cycle,
y = Change,
group = Study_ID,
)
) +
scale_shape_manual(
values = c(16,18)
) +
scale_color_brewer(
palette = "Set1"
) +
scale_x_continuous(
name = "Cycle",
breaks = c(0,2,4,6,8,10,12,14,16,18,20,30,40,45),
limits = c(0,45),
expand = expansion(mult = c(0,0.001))
) +
scale_y_continuous(
name = "Percent Change in Lesion SLD (%)",
breaks = c(-1,-.75,-.50,-.40,-.30,-.20,-.10,.10,.20,.30,.40,.50,.65),
limits = c(-1,.65),
labels = percent
) +
ggtitle("Response Plot")
p
p_dml <- rvg::dml(ggobj = p)
# initialize PowerPoint slide ----
officer::read_pptx() %>%
# add slide ----
officer::add_slide() %>%
# specify object and location of object ----
officer::ph_with(p_dml, ph_location(width = 10, height = 5)) %>%
# export slide -----
base::print(
target = here::here(
"demo_3.pptx"
)
)
As you can see the distance between each point on the x axis is linear and equal, is there a way to spread out the distance on the plot between 0-20 and make space between 20-40 smaller?
As you can see I have tried to do this using the expand function, but to no avail, I am using the funciton wrong?
Any help would be much appreciated.
Orginal image
Image with scale_x_sqrt
Image with scale_x_continuous(trans = scales::pseudo_log_trans(sigma = 3))
While this is as close as we've gotten to what I am looking for, is there a function that allows me to customize exactly where the ticks are on the axis?


