I have some code which plots a spine chart in a 'for' loop . The chart should have black lines between the domains according to the show_dividers = "outer" argument in the area_profiles function of fingertipscharts. Running the code on its own for one spine chart creates the chart with dividers, running the code in the loop does not. Sorry for the length of this but it is mostly arguments (data is public). Does anyone have any idea why that might be:
library(fingertipscharts)
library(ggplot2)
df_pop1 <- read.csv("https://github.com/Jon51/jonw/raw/master/df_pop1.csv")
gp <- c("GP1", "GP2", "GP3", "GP4")
for(i in gp){
s <- area_profiles(df_pop1,
value = Value,
count = Count,
area_code = AreaCode,
local_area_code = i,
indicator = IndicatorNm,
timeperiod = Timeperiod,
polarity = Polarity,
significance = Significance,
area_type = AreaType,
median_line_area_code = "CCG1",
header_positions = c(-1.43, -0.80, -0.6, -0.4, -0.2, -0.05, 1.1),
header_labels = c("Indicator", "Time\nperiod", "Local\ncount","Local\nvalue", "Bromley\nvalue", "Lowest", "Highest"),
datatable = TRUE,
relative_point_size = 2,
relative_domain_text_size = 0.85,
relative_text_size = 1.2,
bar_width = 0.9,
indicator_label_nudgex = -0.5,
show_dividers = "outer",
domain = Domain)
plot1 <- paste("spine", i, ".png", sep = "")
ggsave(filename = plot1, width = 10, height = 15, dpi = 300)
}
s <- area_profiles(df_pop1,
value = Value,
count = Count,
area_code = AreaCode,
local_area_code = "GP1",
indicator = IndicatorNm,
timeperiod = Timeperiod,
polarity = Polarity,
significance = Significance,
area_type = AreaType,
median_line_area_code = "CCG1",
header_positions = c(-1.43, -0.80, -0.6, -0.4, -0.2, -0.05, 1.1),
header_labels = c("Indicator", "Time\nperiod", "Local\ncount","Local\nvalue", "Bromley\nvalue", "Lowest", "Highest"),
datatable = TRUE,
relative_point_size = 2,
relative_domain_text_size = 0.85,
relative_text_size = 1.2,
bar_width = 0.9,
indicator_label_nudgex = -0.5,
show_dividers = "outer",
domain = Domain)
s
plot <- paste("divider", ".png", sep = " ")
ggsave(filename = plot, width = 10, height = 15, dpi = 300)
I am plotting 60 indicators in my spine chart and the black line is not appearing although I can see there is a wider white gap where it should be.