openprescribingR Plots2


Experimenting with timelapse drawing in ‘Procreate’ the ios app; made the following for openprescribingR.

See the code used in this example here.

See the repository on github.

And a couple I made afterwards after exploring geom_line/geom_ribbon properly.

Below is a geom_step of each practice spending in the CCG (median value = blue, the chosen clinic’s spending = red). The second is a geom_line version of the same data + dark geom_ribbon for the Q1-Q3, light geom_ribbon for the min-max of values.

I’ve also been trying out ggiraph recently, which seems promising but I’ll need to learn more javascript to take full advantage of it and create fully interactive graphs.

westkent <- location_function("99J", as_sf = TRUE)
westkent <- westkent %>%
    lon = map_dbl(geometry, ~st_centroid(.x)[[1]]),
    lat = map_dbl(geometry, ~st_centroid(.x)[[2]])
westkent$name <- str_replace_all(westkent$name, "'", " ")

gg_point =  ggplot() +
  geom_sf(data = westkent[1,]) +
  geom_point_interactive(data = westkent[2:86,],
                         aes(x = lon, y = lat, tooltip = name)) +
  coord_sf(crs= 4326, datum = sf::st_crs(4326))
ggiraph(code = {print(gg_point)})

Last Modified:
Next: 'openprescribingR Plots3'
Prev: 'More examples for openprescribingR'