-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vars argument for plot_sf #516
Comments
Correct me if I'm wrong, but you can do that right now by |
I guess that is true. It is perhaps not very easy to discover, though.
Intuitively, that looks like plotting a single vector.
David
…On 14 October 2017 at 19:08, Jakub Nowosad ***@***.***> wrote:
Correct me if I'm wrong, but you can do that right now by
plot(sf_object["var_name"]).
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#516 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AFjJ98akMLwYfPp8CPnFUbDg5sj43sGWks5ssPi2gaJpZM4P5d3l>
.
|
On a similar note I find that I often end up just writing I would too vouch for a "default" behaviour which just plots the geometry, or maybe just the first "column" of the object. If I read the documentation correctly, implementing the second option would just mean to change the default value for max.plot (currently, set to 9). |
The "logic", if you wish, of this behaviour is that I agree that in case of many attributes the default of plotting the first 10 is rather arbitrary (but similar to what tibbles do). We could manipulate this by creating a global option (e.g., I don't agree that for and |
Maybe just reducing the default would be reasonable. I had the same problem
as Lorenzo of waiting for very large objects to plot.
David
…On 15 October 2017 at 14:26, Edzer Pebesma ***@***.***> wrote:
The "logic", if you wish, of this behaviour is that plot(x) gives you a
plot of x, i.e. its entirety. I believe that many people make different
assumptions because in sp, plot(x) was synonymous to plot(geometry(x)),
and this has been so for over a decade. The disadvantage of that was that
for every quick plot, you'd have to start messing with classifying a column
and mapping it to colors. Think of what you see with you plot(mtcars):
it's not good, but does plot all variables, and pairs.
I agree that in case of many attributes the default of plotting the first
10 is rather arbitrary (but similar to what tibbles do). We could
manipulate this by creating a global option (e.g., options("sf.plot_ncol")).
I'm not a fan of global options, but would consider a PR doing (and
documenting) this in a clean way (see e.g. file AAA.R in package sp).
I don't agree that for and sf object with attributes, plot(x) and
plot(st_geometry(x)) should do the same thing.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#516 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AFjJ99bBzZSDioNtWfJEO0g6VTEy3_myks5ssggPgaJpZM4P5d3l>
.
|
On most platforms, plot can be easily interrupted without disturbing your R session. A single map can also be so large that you have to wait for it to plot. And when you're ready to use |
I think the "global option" idea could be a good "compromise" (and could maybe useful also for customizing other options users may wish to customize in the future). I'll see if I can manage to do a PR in the next days. |
I find using library(sf)
library(tidyverse)
nc = st_read(system.file("shape/nc.shp", package="sf"), quiet = TRUE)
nc %>%
select(AREA, NAME) %>%
plot() |
Related to #457. I appreciate one should do
plot(sf_object$geometry, ...)
, but I think the geometry column is an implementation detail, and many users will just hope to doplot(sf_object)
and select the variable(s) they want to plot. So, could I suggest an argument to the plot function that selects one or more variables to plot? If you're agreeable to this, I could try to provide a pull request.The text was updated successfully, but these errors were encountered: