@@ -48,35 +48,48 @@ plot_rates_funnel <- function(
4848 y_axis_limits ,
4949 x_axis_title
5050) {
51+ cl_line_type <- " dashed"
52+ cl_colour <- " black"
53+
54+ cl2_line_type <- " dashed"
5155 cl2_colour <- " black"
56+
57+ cl3_line_type <- " dashed"
5258 cl3_colour <- " black"
53- cl_line_type <- " dashed"
59+
60+ plot_x_range <- c(0 , max(rates_funnel_data $ denominator ) * 1.05 )
61+ function_x_range <- plot_x_range * 1.2
5462
5563 rates_funnel_data | >
5664 ggplot2 :: ggplot(ggplot2 :: aes(.data $ denominator , .data $ rate )) +
5765 ggplot2 :: geom_hline(
5866 yintercept = funnel_calculations $ cl ,
67+ colour = cl_colour ,
5968 linetype = cl_line_type
6069 ) +
6170 ggplot2 :: geom_function(
6271 fun = funnel_calculations $ lcl2 ,
6372 colour = cl2_colour ,
64- linetype = cl_line_type
73+ linetype = cl2_line_type ,
74+ xlim = function _x_range
6575 ) +
6676 ggplot2 :: geom_function(
6777 fun = funnel_calculations $ ucl2 ,
6878 colour = cl2_colour ,
69- linetype = cl_line_type
79+ linetype = cl2_line_type ,
80+ xlim = function _x_range
7081 ) +
7182 ggplot2 :: geom_function(
7283 fun = funnel_calculations $ lcl3 ,
7384 colour = cl3_colour ,
74- linetype = cl_line_type
85+ linetype = cl3_line_type ,
86+ xlim = function _x_range
7587 ) +
7688 ggplot2 :: geom_function(
7789 fun = funnel_calculations $ ucl3 ,
7890 colour = cl3_colour ,
79- linetype = cl_line_type
91+ linetype = cl3_line_type ,
92+ xlim = function _x_range
8093 ) +
8194 ggplot2 :: geom_point(ggplot2 :: aes(
8295 colour = .data $ is_peer ,
@@ -97,7 +110,7 @@ plot_rates_funnel <- function(
97110 ) +
98111 ggplot2 :: theme(legend.position = " none" ) +
99112 ggplot2 :: scale_x_continuous(labels = scales :: comma_format()) +
100- ggplot2 :: coord_cartesian(ylim = y_axis_limits ) +
113+ ggplot2 :: coord_cartesian(xlim = plot_x_range , ylim = y_axis_limits ) +
101114 ggplot2 :: labs(x = x_axis_title ) +
102115 theme_rates(has_y_axis = FALSE )
103116}
0 commit comments