Skip to content
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

selected.* aesthetics #161

Open
tdhock opened this issue Aug 4, 2016 · 0 comments
Open

selected.* aesthetics #161

tdhock opened this issue Aug 4, 2016 · 0 comments

Comments

@tdhock
Copy link
Owner

tdhock commented Aug 4, 2016

In general selected.* aesthetics are to let the plot designer answer the question, "how should the geom look after it is clicked?" right now in animint we use a simple heuristic which is not configurable by the plot designer

  • when a geom_rect is clicked we set its border (stroke) color to black. Otherwise it has no border. Using selected.* aesthetics we could say color=NA and selected.color="black"
  • when any other geom is clicked we set its alpha (opacity) to 0.5 more than the value that was specified in the R code. using selected.* aesthetics we could say alpha=0.5 and selected.alpha=1, or alpha=0 and selected.alpha=0.5.
    The idea of selected.* aesthetics is to make this behavior more configurable, so the designer can change what the geoms look like after they are clicked. However if you implement this new feature, please make sure to respect these settings as defaults.

@viswaraavi here are detailed answers to your questions.

For this example 
p <- ggplot() +
  geom_point(data = tips, 
             aes(x = total_bill, y = tip, colour = sex_smoker),selected.colour="Red")
we will have all the legends selected and all the data is shown and the legends will
respond to mouse clicks and update selection.

that is correct. However, the selected.colour will have no effect, since there is no clickSelects aesthetic specified. selected.colour="red" means that the point color should be changed to red when the point's clickSelects value is selected.

What will be the difference between specifying colour and selected.colour?
Is it that if we specify colour all the variable will be shown with colour red. But with
selected.colour we want only selected variable to be in colour red.
  • selected.colour=red means we want to change the point color to red when it is clicked (has no effect if no clickSelects is specified).
  • color=red mean we want the point color to be red when it is not clicked.
If this is the
case then if multiple variables are selected then will all have red colour?. If variables are not 
selected what colour will they have?

again if you do not specify clickSelects then none of the points will be red. they will all be black (ggplot2 default).

if you do specify clickSelects, for example

p <- ggplot() +
  geom_point(data = tips, 
             aes(x = total_bill, y = tip, clickSelects=sex_smoker), selected.colour="Red")

then I would expect all points corresponding to the selected sex_smoker are red, and other points are black.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant