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

Animation with the Pirates dataset #67

Closed
kferris10 opened this issue May 17, 2015 · 4 comments
Closed

Animation with the Pirates dataset #67

kferris10 opened this issue May 17, 2015 · 4 comments

Comments

@kferris10
Copy link
Collaborator

I've been putting together an example with the pirates dataset the last couple days. I thought I'd post the current version here to see if you have any thoughts before adding it to the animint examples.

I also noticed a couple of issues that I wanted to bring up. Here's what my ggplot2 version of the binned plot looks like.

image

There's a couple of things that don't transfer to animint:

  1. I implemented a blue background for the water using theme(panel.background = element_rect(fill = "lightblue")). Is there currently a way to get animint to color the background?
  2. I'm drawing edges on the tiles using geom_tile(aes(...), colour = "red", data = p_df3) but animint isn't drawing the edges.
  3. I use `geom_polygon(aes(...), colour = "darkgreen", fill = "lightgrey") to draw the countries. The borders of the countries look a little bit thicker than I'd like. Is there a way to draw thinner lines?
@srvanderplas
Copy link
Collaborator

On Sun, May 17, 2015 at 11:57 AM, Kevin Ferris notifications@github.com
wrote:

I've been putting together an example with the pirates dataset the last
couple days. I thought I'd post the current version
http://bl.ocks.org/kferris10/raw/b36f6084ebfb57f9ad4a/ here to see if
you have any thoughts before adding it to the animint examples.

I also noticed a couple of issues that I wanted to bring up. Here's what
my ggplot2 version of the binned plot looks like.

[image: image]
https://cloud.githubusercontent.com/assets/6612411/7671225/fb2ba6f0-fc81-11e4-92b2-f35a79ad327d.png

There's a couple of things that don't transfer to animint:

I implemented a blue background for the water using theme(panel.background
= element_rect(fill = "lightblue")). Is there currently a way to get
animint to color the background?

Not currently. That said, it should be fairly easy to make this happen in
animint (for now, you could just add a single rectangle in blue as the
first geom...)

I'm drawing edges on the tiles using geom_tile(aes(...), colour =
"red", data = p_df3) but animint isn't drawing the edges.

Try adding it inside the aes statement as color=I("red"), but this should
go in the TODO list.

I use `geom_polygon(aes(...), colour = "darkgreen", fill =
"lightgrey") to draw the countries. The borders of the countries look a
little bit thicker than I'd like. Is there a way to draw thinner lines?

Try adding size=1 or something outside the aes statement, and if that
doesn't work, add it inside.


Reply to this email directly or view it on GitHub
#67.

@kferris10
Copy link
Collaborator Author

  1. Nice idea. Also, I can change the size of the lines here

  2. It doesn't do anything when I put it outside. animint2dir got mad when I tried to put it inside the aes statement:

    animint2dir(...)
    Don't know how to automatically pick scale for object of type AsIs. Defaulting to continuous
    Error: Discrete value supplied to continuous scale

    However, I found that I can change the color of the rectangle that I'm using for the blue background. Any idea where the difference is? I'd be happy to try and fix it if you can point me in the right direction.

  3. That took care of it. Any idea why that is needed? I would think that should be the default.

Updated visualization

@tdhock
Copy link
Owner

tdhock commented May 19, 2015

About the blue background, using a blue geom_rect is a clever workaround with the current code, but I would suggest this is a good time to actually implement that theme feature in animint. Basically that would mean (1) telling the compiler to extract the blue color from the theme element in parsePlot https://github.com/tdhock/animint/blob/master/R/animint.R#L61 and then (2) tell the renderer to color the <svg> element, inside of add_plot https://github.com/tdhock/animint/blob/master/inst/htmljs/animint.js#L180

About the viz itself, I would suggest to add a second selection variable. For example, geom_tile(aes(clickSelects=location)) in the second map, and then change the time series plot to geom_line(aes(showSelected=location)) and use selector.types=list(location=multiple) ... this reminds me of a similar viz I did with some climate change data, see http://cbio.ensmp.fr/~thocking/animint-climate-change/index.html and source https://github.com/tdhock/climate-change/blob/master/figure-stations.R for possible inspiration.

@tdhock
Copy link
Owner

tdhock commented May 19, 2015

closing issue and moving discussion to #68

@tdhock tdhock closed this as completed May 19, 2015
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

3 participants