R Maps: Beautiful Interactive Choropleth & Scatter Maps with Plotly

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ธ.ค. 2024

ความคิดเห็น • 71

  • @jessicah3782
    @jessicah3782 3 ปีที่แล้ว +7

    I love how fast and smooth you teach. Everything is so fluid and clear. Thanks!

    • @UCKszbcV
      @UCKszbcV 2 ปีที่แล้ว

      So fast I needed to activate x0.75 reproduction speed

  • @NE0KRATOS
    @NE0KRATOS 4 ปีที่แล้ว +10

    Thank you so much! I feel so lucky to have found your channel. The quality is top notch as always, and I hope it will grow as it deserves! Cannot wait to see more of your videos!

  • @alexsanjose
    @alexsanjose 4 ปีที่แล้ว +7

    Yet another amazing video. I've been working on R for 10 years now, but I always learn something new and cool in your videos!

    • @dataslice
      @dataslice  4 ปีที่แล้ว

      That’s great to hear, thanks!

  • @mkklindhardt
    @mkklindhardt 2 ปีที่แล้ว

    Thank you! Especially the static map using plotly was super helpful.

  • @jannatulferdous8846
    @jannatulferdous8846 4 ปีที่แล้ว

    You are awesome. I was struggling to plot the US map for Election funding by states. I was about to go crazy. Your code has saved my sanity.

  • @BugsDavid
    @BugsDavid ปีที่แล้ว +2

    For the ones not managing to get the code right in the first example with the minimum wage data. For the inner_join command type it like: inner_join(states, by = c("State" = "state")). The rest as in the video. Greetings !

  • @Purplehairedpimp
    @Purplehairedpimp 3 ปีที่แล้ว +3

    I really like your presentation. Surprised it doesn't have more views; it's well done. However I'm still on the hunt for a solution to make a combined Mapbox(OpenStreetMaps) + Chloropleth + Scatterplot map, using ploty/R/Shiny that is.

  • @terraflops
    @terraflops 3 ปีที่แล้ว

    Thanks for your video, I suspect you are the same person that's behind "X software in 100 seconds" videos (sound the same).
    // I had to pass in a x and y for the ufos_graphs function, and had to give y= ~ufos$latitude, x= ~ufos$longitude in order for this to work.
    // new subscriber!

  • @tobih.4491
    @tobih.4491 2 ปีที่แล้ว +1

    Thanks a lot, that is super useful! Can I ask one thing though: I would like to do the same thing for the German states (Bundesländer) and played around quite a bit with adjusting the locationmode. However, what I get at the end is always a map of the entire world, without any borders (be it country or state borders) whatsoever. Does anyone know how to replace the locationmode accordingly? That would be wonderful!

  • @ibrahimadiallo7444
    @ibrahimadiallo7444 3 ปีที่แล้ว

    Definetly earned my subscription 😌❤

  • @murtazabadshah8747
    @murtazabadshah8747 8 หลายเดือนก่อน

    Do you have a video on making a bargraph with a drop down filter?

  • @naterush5019
    @naterush5019 4 ปีที่แล้ว

    This is so well done and informative!

    • @dataslice
      @dataslice  4 ปีที่แล้ว

      Thanks so much!

  • @cheettaah
    @cheettaah 3 ปีที่แล้ว

    Great video. Bravo!

  • @anissuraiya2370
    @anissuraiya2370 2 ปีที่แล้ว +1

    Thanks, for the video. I use this for another data I found. I post it in my blog and link your video too, is it okay?

  • @haraldurkarlsson1147
    @haraldurkarlsson1147 2 ปีที่แล้ว

    Nice overall but I think plotly is a rather cumbersome and confusing way of going given all the other great packages that can do interactive maps.
    By the way there is a way to handle the state abbrevations without having to bring in another dataset namely the built-in package usdata : usdata::state2abbr(State). It leaves out Guam and Puerto Rico but that can be remedied with mutate statement ( mutate(state_abb = if_else(state == "Guam", "GU",state_abb), state_abb = if_else(state == "Puerto Rico", "PU", state_abb)).
    Thanks - we need more on mapping.

  • @mm_007
    @mm_007 2 ปีที่แล้ว +1

    Do you have an example how to plot r plotly chloropeth map for non-US states? I need to plot cities of canada with given latitude and longitude.

  • @ibrahimadieye2258
    @ibrahimadieye2258 3 ปีที่แล้ว +1

    This is an awesome video! Thank you. I have one question. Is there a way to show the abbreviation on each state (as the state label) in addition to the hover window?

    • @dataslice
      @dataslice  3 ปีที่แล้ว

      I believe you need to add a scattergeo trace as a layer to the map. There's some documentation here about it plotly.com/r/reference/#scattergeo

  • @gabriellamartinez7985
    @gabriellamartinez7985 2 ปีที่แล้ว

    Thank you for your video! It has really helped me get my assignment started.
    QUESTION: Is there a way to add a drop down filter for an additional categorical column. For example, lets say there was an additional column for Gender where there is then multiple values for the Wage column in the same year, how would we be able to filter to see the wage for each specific gender?

  • @simba8026
    @simba8026 4 ปีที่แล้ว

    thank you. your videos are great

    • @dataslice
      @dataslice  4 ปีที่แล้ว

      Glad you like them!

  • @melandsant
    @melandsant 3 ปีที่แล้ว

    thank you for great lesson. I want to ask a question about how to change legend's range?

  • @22bears
    @22bears 2 ปีที่แล้ว

    If i don't have a CSV of the abbreviation of my states, which kind of plot can I use instead?

  • @MMansouri
    @MMansouri 4 ปีที่แล้ว

    Another great video!

  • @somebodyoncetoldme2069
    @somebodyoncetoldme2069 3 ปีที่แล้ว +1

    Hi, do you know how to make the size of the graph bigger in r markdown and bring the timescale slider closer to the graph?

    • @dataslice
      @dataslice  3 ปีที่แล้ว +1

      I haven't played around with it, but it looks like you can modify the x and y position of the slider (some documentation here plotly.com/r/reference/layout/sliders/) and could set the graph size by passing in parameters for width and height in the layout() like here plotly.com/r/setting-graph-size/

    • @somebodyoncetoldme2069
      @somebodyoncetoldme2069 3 ปีที่แล้ว

      @@dataslice thank you so much

  • @filanor2416
    @filanor2416 4 ปีที่แล้ว

    Excellent content on interactive mapping in R. I just only want to point out that link for the UFO Sightings dataset is incorrect. I wish you continued success and thank you..

    • @dataslice
      @dataslice  4 ปีที่แล้ว +1

      Thanks for letting me know, I just fixed it!

    • @yobeaubaby
      @yobeaubaby 4 ปีที่แล้ว

      Thank you 🤙

  • @soumia117
    @soumia117 2 ปีที่แล้ว

    Hi is there a way to only show Los Angeles County in plotly?

  • @frankjr3787
    @frankjr3787 2 ปีที่แล้ว

    How would you plot the lats and longs over time

  • @CAVescera
    @CAVescera 4 ปีที่แล้ว

    You are so awesome at this. So easy going, and easy to follow. One thing- I want to make a state/county map showing employee locations. I have FIPS, State, County, and the count of employees in each FIPS. I can get that working, but is there an easy way to create a dropdown by State, and another by county? I can't find this anywhere, and everywhere I DO look, the programmers are far beyond my skill level. Thanks!

    • @dataslice
      @dataslice  4 ปีที่แล้ว

      I believe you can add drop downs the way you want to, maybe try following this documentation plotly.com/r/dropdowns/
      Also if you’re not tied to R I’d recommend checking out Tableau public if you want something a bit more user friendly

  • @jaroslavkotrba3548
    @jaroslavkotrba3548 4 ปีที่แล้ว

    It is a nice video, however, wondering where there is a possibility to DISABLE zooming in the plot?

  • @mirandaansell4434
    @mirandaansell4434 3 ปีที่แล้ว +1

    Loved this! Is there any way of being able to knit the first map into HTML? :)

    • @dataslice
      @dataslice  3 ปีที่แล้ว +1

      If you're trying to export the whole graph as an HTML to embed onto a page, you can use htmlwidgets::saveWidget(as_widget(graph), "graph.html") where graph is your plotly graph variable

  • @debarghaguhaneogi8048
    @debarghaguhaneogi8048 2 ปีที่แล้ว

    I was facing issues to set zmin and zmax, there is no change in the behaviour of z even after adding zmin and zmax, please help me out

  • @EleanorMeader
    @EleanorMeader 11 หลายเดือนก่อน

    Is there a way to change the name of the frame? My map looks a little untidy because the frame variable has been pulled straight from the data frame, and i'd like to rename it to make it neater.

  • @paras338
    @paras338 4 ปีที่แล้ว

    Hello, Awesome video!
    I just wanted to ask one question that if I want to create a similar choropleth map for Australian states and their crime rates, I am not able to display the data using the code. I tried changing the locationmode to 'australia', 'australia-states', 'Australia' and 'australian-states' and many other options but I am unable to create the same graph.
    Could you please guide me with what changes do I need to make for Australian states. (My data already has state abbreviations like VIC, NSW etc)
    Waiting for your response.
    Thanks

    • @dataslice
      @dataslice  4 ปีที่แล้ว

      Thanks for your question! I've been trying to look into this but from the documentation, it looks like the only scopes supported are: ( "world" | "usa" | "europe" | "asia" | "africa" | "north america" | "south america" ). I'm wondering if you could set the scope to world and then also just have the map zoomed in or set to be looking at Australia and then disabling panning? I'll need to look into this more but let me know if that works

    • @paras338
      @paras338 4 ปีที่แล้ว

      @@dataslice Thank you so much for your response. Yes, I also checked and found out that there is no support for Australian map and we need to plot it like the way you explained. Anyways, I will check for more alternatives and will update if I find something helpful.
      Cheers.

  • @popcornnakkini
    @popcornnakkini 3 ปีที่แล้ว

    how to make it display in shiny app ? I've try my code. local is fine, but error display in my shiny app? can you help how to make it?

  • @purbashachowdhury2985
    @purbashachowdhury2985 3 ปีที่แล้ว

    Hey! how to plot similar graph for Indian states? Plz give me ideas.

  • @victorog8249
    @victorog8249 3 ปีที่แล้ว

    Thank you for the video! Do you know how to include the interactive "minwage_graph" into Overleaf/LaTeX?

    • @haraldurkarlsson1147
      @haraldurkarlsson1147 2 ปีที่แล้ว

      You can save the map (ggsave or something like that) and then bring it into LaTeX. Might be wise to scale it in R first. By the way there is a package for maps in LaTeX - relatively new and a bit tricky. It is called mercatormap. I needs python but can do some basic stuff without it in manual mode.

  • @ernestamoore4385
    @ernestamoore4385 2 ปีที่แล้ว

    Where can we find the csv?

  • @babatundeolapeju1407
    @babatundeolapeju1407 3 ปีที่แล้ว

    That was an interesting and amazing video, Dataslice. Great job!
    However, I kindly seek your help here. I wish to make a choropleth map by states on Nigeria land space but I only got a blank map of the world, unlike the result you got. I think something is wrong with the location mode I used.
    Hereunder is my code:
    crime_df = read_excel("/Users/user/Desktop/Crime Report 2017/Crime Report 2017.xlsx", sheet = "Sheet2")
    murder1 = (crime_df)%>% select(YEAR, CODE, MURDER)
    mur_graph = plot_geo(murder1, locationmode = "Nigeria-state",
    frame = ~YEAR) %>%
    add_trace(locations = ~CODE,
    z = ~MURDER,
    color = ~ MURDER)
    Kindly put me through, please.

  • @areeratsriprai3155
    @areeratsriprai3155 3 ปีที่แล้ว

    how to export it to gif?

  • @ojas24singh25
    @ojas24singh25 4 ปีที่แล้ว

    for some reason im not able to use the select funtion. How do i solve it?

    • @dataslice
      @dataslice  4 ปีที่แล้ว

      Have you installed and loaded in the dplyr package?

    • @ojas24singh25
      @ojas24singh25 4 ปีที่แล้ว

      @@dataslice Now it says that my plotly and dplyr packages are masked for some reason. Also i cannot believe you have less than 500views on this. the video was amazing. Thank you for helping, i have a competition tomorrow and im trying to make the same kind of map for covid cases state and month wise.

    • @ojas24singh25
      @ojas24singh25 4 ปีที่แล้ว

      the plotly package. is masked by ggplot2 and the dplyr is masked by stats.

    • @dataslice
      @dataslice  4 ปีที่แล้ว +1

      ​@@ojas24singh25 I haven't had this issue but from looking online, it looks like you need to 'reload' the package -- something like this? library(devtools)
      reload(inst("dplyr")). Not sure if that'll work, but good luck with the competition!

  • @rashawnhoward564
    @rashawnhoward564 3 ปีที่แล้ว

    datasets::state.abr gives states abbreviations in r

  • @sapiain16
    @sapiain16 4 ปีที่แล้ว

    Thank you!!

  • @tello9504
    @tello9504 4 ปีที่แล้ว

    Any book that you recommend for R? I’m newwwbiee

    • @DiggyRasta
      @DiggyRasta 4 ปีที่แล้ว +1

      I recommend starting with this book ( r4ds.had.co.nz/index.html ) and this package to practice ( swirlstats.com/students.html ).
      And here are some more books you can look into once you're more comfortable ( rstudio.com/resources/books/ ).

    • @tello9504
      @tello9504 4 ปีที่แล้ว

      @@DiggyRasta wooow! Thank you, Sorie

    • @DiggyRasta
      @DiggyRasta 4 ปีที่แล้ว +1

      @@tello9504 I got you bro

    • @tello9504
      @tello9504 4 ปีที่แล้ว

      @@DiggyRasta 🥺🥺🥺 love you bro

  • @ojas24singh25
    @ojas24singh25 4 ปีที่แล้ว

    it says object not found

  • @bigg1esworth
    @bigg1esworth 4 ปีที่แล้ว

    Cool vid

  • @Downesy230
    @Downesy230 3 ปีที่แล้ว

    Anyone done this in Python?

  • @timecode37
    @timecode37 3 ปีที่แล้ว

    Haha, zmin