Closed luukvdmeer closed 3 years ago
Implemented by @loreabad6
library(sfnetworks)
library(ggplot2)
autoplot(as_sfnetwork(roxel)) + ggtitle("Road network of Roxel")
Created on 2020-11-02 by the reprex package (v0.3.0)
Pushed to master. Thanks @loreabad6, looks great! See also the function reference.
Is it possible to control aes of points and lines as arguments to autoplot, or does it require to recreate the plot? autoplot is very lean and it would be great to control the bit complex sfnetwork object form there
Is it possible to control aes of points and lines as arguments to autoplot, or does it require to recreate the plot? autoplot is very lean and it would be great to control the bit complex sfnetwork object form there
found a very hacky solution, wouldn't advice to use it:
net %E>% mutate(rn = row_number()) %>% filter(rn %in% 21:28) %N>% filter(!node_is_isolated()) %E>% { (.) %>% autoplot() + aes(color = (.) %>% as_tibble() %>% pull(rn) %>% factor()) }
Hi @idshklein! I'm pretty sure that, at the moment, you cannot adjust the aesthetics of points and lines geometries using the default autoplot method. I think autoplot.sfnetwork
was deliberately designed with some restrictions and it is suitable just for quick and simple visualisations.
In any case, I suggest you ask the same question in a new github issue since, IMO, your question/suggestion will be quickly forgotten if you only post it in a closed issue.
Is your feature request related to a problem? Please describe. Among others, the time series packages from Rob J Hyndman and co have a nice
autoplot
method, which allows to directly create aggplot
object. For example, the autocorrelation function of a time series can be plotted directly without any tuning:Created on 2020-10-28 by the reprex package (v0.3.0)
See https://feasts.tidyverts.org/reference/autoplot.tbl_cf.html
Describe the solution you'd like It might be nice to have an autoplot method for
sfnetwork
objects, next to the base plot method. Low priority.