Spencer Schien
Spencer Schien
  • 15
  • 38 929
Rayshader Tutorial: Acadia National Park Shaded Relief Map
This is a live coding tutorial where I show how to us the {rayshader} package in R to create a 3D shaded relief map. Acadia National Park serves as an example. Full code available here: github.com/Pecners/rayshader_portraits.
Переглядів: 382

Відео

L'Hexagone en Tour Eiffel
Переглядів 12011 місяців тому
This fun video show mainland France represented by a hexagonal grid that blinks to simulate the blinking of the Eiffel Tower. France is sometimes called "The Hexagon" (L'Hexagone in French) because it's shape roughly resembles a hexagon. #france #satisfying
Tidyverse tip: Create percentage column with multi-level grouping
Переглядів 150Рік тому
My last video showed how to add a summary column with percentages, and in this video, I expand the example to do the same this with multi-level groups.
Tidyverse tip: easily create percentage column in R
Переглядів 1,8 тис.Рік тому
It's easy to create a summary column in R that shows percentages.
How to have your computer tell you when your R script finishes
Переглядів 137Рік тому
This video shows how you can use the 'say' command on a Mac to make an R script speak when your R script is done.
Live Coding: Vermont Population Density (Part I)
Переглядів 534Рік тому
This is a live coding session where I create a 3D population density map of Vermont. This video goes through the rendering process to create the high-quality graphic. Part II will cover adding annotations.
Join and Summarize Spatial Data
Переглядів 1,8 тис.Рік тому
This is an R coding tutorial that shows how combine and summarize spatial data. Specifically, I show how you can take lat-long coordinates, convert them to spatial objects, and join and summarize them with spatial polygons. I show both pre-defined polygons (French Departments) as well as user-created polygons (hexagonal grid). The example I use takes French winery locations from OpenStreetMap d...
Live Coding: Population Density along the Seine
Переглядів 7 тис.Рік тому
This is a live coding video that shows my process for creating these sorts of graphics. This is not intended to be a tutorial, and I don't explain things in great detail.
Double group on x axis with ggplot
Переглядів 4,3 тис.Рік тому
This is a live coding tutorial that shows how you can create a plot that has two levels of groupings along the x axis. This is done by using facets, but hiding all the traditional trademarks of the facet panels. Code can be found here: github.com/Pecners/penguins_facet_live_coding 2:31 Create R Project 4:02 Install Download {palmerpenguins} 6:04 Summarize Data 8:03 Start Plotting 11:28 Add Face...
Rayshader Tutorial-Florida Population Density
Переглядів 22 тис.Рік тому
This is a live-coding tutorial that walks through how to create a 3D population density map in R using the rayshader package. The example uses Kontur Population data for the state of Florida. Code from this tutorial is available here: github.com/Pecners/kontur_rayshader_tutorial NOTE: Before starting, I recommend you install the latest dev versions of rayshader and rayrender to avoid an error t...

КОМЕНТАРІ

  • @chooby364
    @chooby364 3 місяці тому

    I have a similar case where one of my species category (lets assume Gentoo) has only lenght measurements. When I plot I get depth and length labeling to appear under Gentoo but actually there is no depth barplot. How can I tell R Studio to delete the depth barplot for that specific Gentoo species? Thanks in advance

  • @sagarrawal8332
    @sagarrawal8332 4 місяці тому

    I used following code to add label and label appears in snippet but whenever i use render_highquality, the text label don't appear and is replaced by rectangular box with black color in place of text. i.imgur.com/enW9d47.png render_label(elev_matrix, lat =27.663, long =85.29765, extent=attr(elev_img, "extent"), freetype=T, zscale = 6, text = "My label", textcolor = "Black" dashed = F, textsize = 1, linewidth = 2, linecolor="Darkorange")

  • @sagarrawal8332
    @sagarrawal8332 4 місяці тому

    Did i miss something in tutorial ? How that 400 meter ( 1/4th mile) was calcualted ?

    • @MrPecners
      @MrPecners 4 місяці тому

      It’s not calculated in the video, that’s provided by the data source, Kontur.

    • @sagarrawal8332
      @sagarrawal8332 4 місяці тому

      @@MrPecners Thank you. The tutorial was indeed very helpful.

    • @sagarrawal8332
      @sagarrawal8332 4 місяці тому

      @@MrPecners How to add scale to show the density value of minimum and maximum density ?

    • @sagarrawal8332
      @sagarrawal8332 4 місяці тому

      @@MrPecners Is there a way to add color bar with range of matrix using same texture as in plot?

  • @SyarmineS
    @SyarmineS 8 місяців тому

    Been doing this and at only at 58:24 you just mentioned you are on Macbook Pro. hahaha

  • @alexvm8352
    @alexvm8352 8 місяців тому

    What’s the difference between the matrix size and the high quality render size(width/height)?

  • @Pongant
    @Pongant 9 місяців тому

    What an amazing package.

  • @yashwanthermann
    @yashwanthermann 9 місяців тому

    Do you have a guide to this?

    • @MrPecners
      @MrPecners 9 місяців тому

      I have tutorials where I walk through the whole process of creating visuals like this. This one is a good starting place: ua-cam.com/video/zgFXVhmKNbU/v-deo.html.

  • @jensonvictor84
    @jensonvictor84 10 місяців тому

    Thank you very much... this was very helpful

  • @ozmenmedine
    @ozmenmedine 10 місяців тому

    Hi Spencer! Thank you very much for your amazing tutorial! I would like to try this. However, I need your help :) In the beginning, you downloaded the states with "tigris" package, but as I understand this is special for the USA. So, how can I download it to Turkey's states? Could you help me, please? Because I am a beginner at this.. Many thanks.. Medine

    • @MrPecners
      @MrPecners 10 місяців тому

      Hi Medine, thanks for your message! You can use the {geodata} package. For instance, here's some code to get you started: turkey <- geodata::gadm("TUR", level = 1, path = tempdir()) |> st_as_sf()

  • @larissamuller3423
    @larissamuller3423 Рік тому

    So amazing! I was wondering if you ever use the threejs package in R to show these datasets on a global 3d map. I have been trying to translate these datasets with that package but I have been having a difficult time. So if you are familiar, I would love to see a tutorial on that!

  • @sayedrohullahkazemi6157
    @sayedrohullahkazemi6157 Рік тому

    Amazing work, thank you.

  • @RoshniAgarwal-lp2fv
    @RoshniAgarwal-lp2fv Рік тому

    the states function we use from tigris package only loads the states of USA. is there any similar package for India? or how do we go about it while plotting the map of India?

  • @johneagle4384
    @johneagle4384 Рік тому

    Wow. Cool Stuff. Impressive. Thank you.

  • @MN-ly9mw
    @MN-ly9mw Рік тому

    Can these be done on Python? I have started to learn Python. Again learning a new language might not be possible for me at this point in life 😢

    • @MrPecners
      @MrPecners Рік тому

      I would guess there’s a way to do this with python, but I don’t know exactly what libraries to use. Rayshader leverages OpenGL, so maybe some python libraries that utilize that tool would be a place to look?

  • @konstantinosiliakis8290
    @konstantinosiliakis8290 Рік тому

    can we put some gpu acceleration on this? my cpu is dying

  • @Asta-SolliljaFarrell
    @Asta-SolliljaFarrell Рік тому

    thank you so much for this! is there any way to make three levels??

  • @datanerdid
    @datanerdid Рік тому

    Great tutorial. You can use ggview package to check the right size of graph before saving it. Cheers.

  • @ahmed007Jaber
    @ahmed007Jaber Рік тому

    nice one. I tried it but it keeps printing 127 with no auditable feedback

  • @MuhammadZubair-yd9ev
    @MuhammadZubair-yd9ev Рік тому

    i am getting error like admin is not found

  • @man0utoftime
    @man0utoftime Рік тому

    Very easy to follow along.

  • @bisyrim1030
    @bisyrim1030 Рік тому

    hello friend I have tried many time to run wineries but it's always end in fail. I don't know how to fix this. 18:00

  • @bisyrim1030
    @bisyrim1030 Рік тому

    your voice is so small. please provide the video with good quality of audio either

    • @man0utoftime
      @man0utoftime Рік тому

      Yeah. He needs to embiggen that voice.

  • @shaikhahmedbd
    @shaikhahmedbd Рік тому

    I can't render in high quality. Tried after updating rayshader & rayrender, still didn't work! > render_highquality( + filename = "images/test_plot.png" + ) Error in rayrender::obj_model(cache_filename, x = -bbox_center[1], y = -bbox_center[2], : unused argument (texture = TRUE)

  • @leekwangchun
    @leekwangchun Рік тому

    It's awesome!!!

  • @vilderislunsj
    @vilderislunsj Рік тому

    Great video. I am a beginner in mapping and plotting with R, so I was wondering - is this possible for non-count data? Lets say you wanted to make the same map but with litres of wine produced per cell/geographic area. I'm assuming you'd need an assigned value to each point and somehow sum all point values within each geographic boundary. Is it possible at all or do you have to use another type of method to produce the same maps?

    • @MrPecners
      @MrPecners Рік тому

      It's possible to do what you describe with basically the same method. You would just swap out the count with a sum of the variable in question. For your example, if each winery had the liters of wine for each winery, you could group by cell and summarize total number of liters in that cell.

    • @vilderislunsj
      @vilderislunsj Рік тому

      @@MrPecners thank you - I’m going to try it out with some data I have as soon as possible!

  • @nevinthomas5130
    @nevinthomas5130 Рік тому

    Hi there, I have just started the tutorial and noticed that the memory usage increases to 6GB or more when reading the data. Is it necessary to have a good CPU and RAM for this tutorial? (my system specs: i5, 4 cores, 16GB RAM.)

    • @MrPecners
      @MrPecners Рік тому

      You will probably struggle to complete the tutorial doing everything the same as I do because it is pretty memory intensive. You should be able to get through it by keeping everything smaller and lower resolution.

    • @nevinthomas5130
      @nevinthomas5130 Рік тому

      @@MrPecners Thanks for the reply

  • @atheeralhejaily9816
    @atheeralhejaily9816 Рік тому

    can you please make the kontur rayshader plot using the same data in this video?

  • @pdcoronado
    @pdcoronado Рік тому

    Que buen material. Espero con ansias el video y los datos que utilizas para replicarlo

  • @merzougahmed4248
    @merzougahmed4248 Рік тому

    Thank you so much. I am taking the approach for applications in the oil and gas industry. Could you please show me how to keep the contour of the state map plotted? thanks

    • @MrPecners
      @MrPecners Рік тому

      Very cool! Here's an example script that you can reference to achieve that, see lines 41-53: github.com/Pecners/rayshader_portraits/blob/main/R/portraits/montana/render_graphic.R

  • @lalitb
    @lalitb Рік тому

    Please upload video of some small country, the Florida data you did on another video my laptop couldn't process that.

  • @pujaadityawinata
    @pujaadityawinata Рік тому

    What an amazing visualization! This inspired me to make my own visualization. Everything is going well when i working with maps that have width > height, i can get the visualization. But when i'm working with maps that have height > width, i got an error in ph_rast <- st_rasterize(st_ph, nx = floor(size * w_ratio), ny = floor(size * h_ratio)) it's say "Error in UseMethod("units") : no applicable method for 'units' applied to an object of class "c('double', 'numeric')" i really appreciate it if u could help me with this error. Thanks!

  • @MarcoZamboni-p4t
    @MarcoZamboni-p4t Рік тому

    Hi Spencer, Thanks a lot for the great video and template code. I ran a few examples and that worked fine. Of course, always time-consuming to find the ideal angles / lighting and resolutions while avoiding crashes. I would have a question related to the height and width. You mention that the unit is in meters based on st_crs(data), but I have some doubts. For Switzerland I get height = 325'262.5m, but Switzerland is only roughly 220km North-South. Could you please clarify?

  • @nikkzm3689
    @nikkzm3689 Рік тому

    Hi, I am getting error while I am executing the st_read() for gpkg file of France's population. " The source could be corrupt or not supported. See `st_drivers()` for a list of supported formats. " Can anyone please tell me how to fix this error? Thank You.

  • @eylonshahar2979
    @eylonshahar2979 Рік тому

    Thank you very much! I'm trying to make a map of Israel but I'm having some difficulties. First : Warning in matrix(israel_rast, nrow = floor(size * w_ratio), ncol = floor(size * : data length [30] is not a sub-multiple or multiple of the number of rows [994] and then: > mat |> + height_shade() |> + plot_3d(heightmap = mat) Error: vector memory exhausted (limit reached?) What should i do?

  • @PrithviJith
    @PrithviJith Рік тому

    Reading (data <-st_read) layer population not working, Could anyone help me.

  • @burakt
    @burakt Рік тому

    Hi Spencer, It gives the warning --> package ‘MetBrewer’ was built under R version 4.2.3 What should I do.

  • @faraazali9589
    @faraazali9589 Рік тому

    Hi Spencer, great tutorial. Im getting the following error on Win 11: mat |> + height_shade(texture=texture) |> + plot_3d(heightmap = mat, + zscale = 6, + background = "#fff8f2", + solid="FALSE", + shadowdepth=0 + ) Error in solid && !triangulate : invalid 'x' type in 'x && y' In addition: Warning messages: 1: 'rgl.surface' is deprecated. Use 'surface3d' instead. See help("Deprecated") 2: 'rgl.viewpoint' is deprecated. Use 'view3d' instead. See help("Deprecated")

  • @ketevanikapanadze7476
    @ketevanikapanadze7476 Рік тому

    Thank you so much! Amazing content. Your code works perfectly on my windows environment but could not finalise on my Mac. At the last point when I try to visualise and save the output I am getting the following error, I tried literally everything but could not succeed. Any ideas/suggestions? Thanks! Error in render_highquality(filename = outfile, interactive = FALSE, lightdirection = 280, : No rgl window currently open.

  • @quazisyedziaulhasanzishan7493

    awesome tutorials sir, What it alternative for tigers package for Indian states.

  • @karytsi
    @karytsi Рік тому

    when executing: mat |> height_shade(texture = texture)|> plot_3d(heightmap = mat, zscale = 80, solid = FALSE, shadowdepth = 0) I get this: Warning messages: 1: 'rgl.surface' is deprecated. Use 'surface3d' instead. See help("Deprecated") 2: 'rgl.viewpoint' is deprecated. Use 'view3d' instead. See help("Deprecated") 3: 'rgl.triangles' is deprecated. Use 'triangles3d' instead. See help("Deprecated") have R 4.2.3 installed... and remotes rayshader... any ideas?

  • @arieldome530
    @arieldome530 Рік тому

    Hello can you help me how to correct this error? Error in rayrender::obj_model(cache_filename, x = -bbox_center[1], y = -bbox_center[2], : unused argument (texture = TRUE)

    • @lcsl5605
      @lcsl5605 Рік тому

      Same problem here. I updated rayrender and rayshader

  • @philippsidler2408
    @philippsidler2408 Рік тому

    Awesome 👏🏻 thanks. Could you do at some point a tutorial how to additionally add mountain reliefs? Living in Switzerland so that would be pretty cool

    • @MrPecners
      @MrPecners Рік тому

      Encoding both population density and elevation to the height axis can make it very hard to interpret. Here's one example I know of: twitter.com/researchremora/status/1630318714343047171

    • @philippsidler2408
      @philippsidler2408 Рік тому

      🙏🏻

  • @lbarq
    @lbarq Рік тому

    Awesome content. How would you label/identify with text on the map the cities of florida? Thanks

    • @MrPecners
      @MrPecners Рік тому

      There technically is a way to do this with Rayshader, but I prefer to do labeling post-render. I use imagemagick (through the R {magick} package) to add text annotations, and I would do the same to add those labels. That requires manual label placement, though...

  • @rajshekarreddy5358
    @rajshekarreddy5358 Рік тому

    Please help me, I'm unable to load the data after downloading into Rstudio.

  • @DataOperationsandResearch

    Hello everyone. If you guys are working on Windows with R 4.2 and the Rstudio crashes/terminates when you run mat |> height_shade(texture = texture) |> plot_3d(heightmap = mat, zscale = 100 ) Then you should use solid = FALSE in the above function and Rstudio would not terminate. So, use the function mat |> height_shade(texture = texture) |> plot_3d(heightmap = mat, zscale = 100, solid = FALSE, ) This problem could be specific to operating system and/or Rstudio/R version. But both I and my colleague faced this issue and it was a working fix. Lastly, great work @Spencer Schien. Wonderful video, keep up the good work.

  • @Notsoprocaptures
    @Notsoprocaptures Рік тому

    Hello Spencer, like Tigris package is specifically for US Shapefile. Can you help me with the package solely for Indian shapefile?

  • @camilatotti2843
    @camilatotti2843 Рік тому

    Thanks so much for your tutorials, it's been amazing learning 3d viz in R with them!

  • @abhisheknayak2088
    @abhisheknayak2088 Рік тому

    This is amazing. Can you making a video of converting ggplot to 3d using rayshader. I was trying to convert pie chart but was facing this error (Discrete value supplied to continuous scale). Thanks in advance

  • @camilaberger2980
    @camilaberger2980 Рік тому

    You are amazing, great project!!!! And thank you to share your knowledge

  • @kevinalexis9886
    @kevinalexis9886 Рік тому

    Is anyone familiar with the following ERROR: Error in c.units(x = nx[[1L]], y = ny[[1L]]) : units are not convertible, and cannot be mixed; try setting units_options(allow_mixed = TRUE)?

    • @MrPecners
      @MrPecners Рік тому

      Wrapping w_ratio and h_ratio in as.numeric() should solve this.

    • @kevinalexis9886
      @kevinalexis9886 Рік тому

      I tried using the both solutions mentioned before: units_options(allow_mixed = TRUE) and drop_units(w_ratio) Without any success Im now getting the following ERROR: Error in stopifnot(is.character(values), is.numeric(x)) : argument "values" is missing, with no default