title: Logo plots on US Map in R are way too large
body: <p><img src="https://i.stack.imgur.com/vxqtX.png" alt="So, the following graph is the inspiration for this post." /></p>
  <p>Essentially, what I want to do is utilize my data to see which sports teams are selling the most trading cards in each state - and have the brand image file in each respective state.</p>
  <p>My data set looks like this...please note that this is dummy data. Same exact structure, though:</p>
  <pre><code>State     Brand      Sales    %TTL
   AK       Nestle     $260      8%
   AL       Mars       $480      10%
   AZ       Coca Cola  $319      12%
   ...
   WY       Nestle     $200      25%
  </code></pre>
  <p>I've been following <a href="https://dieghernan.github.io/202002_cartography1/" rel="nofollow noreferrer">guide</a> - but it isn't really 1:1. I can't even get the sample code to execute because it says it can't find the online address</p>
  <p>So far, I've modified my code up to this point:</p>
  <pre><code>library(USAboundaries) 
  #&gt;      install.packages(&quot;USAboundariesData&quot;, repos = &quot;https://ropensci.r-universe.dev&quot;, type = &quot;source&quot;)
  library(sf)
  library(tidyverse)
  library(rasterpic)
  library(tidy terra)
  
  states &lt;- USAboundaries::states_contemporary_lores %&gt;%
    select(State = state_abbr) %&gt;%
    # Filter AK and HW
    filter(!(State %in% c(&quot;AK&quot;, &quot;HI&quot;, &quot;PR&quot;))) %&gt;%
    st_transform(&quot;ESRI:102003&quot;) 
  
  states
  
  plot &lt;- ggplot(states) +
    geom_sf(fill = &quot;white&quot;) +
    theme_minimal() +
    theme(panel.background = element_rect(fill = &quot;lightblue1&quot;))
  
  plot
  
  teams &lt;- data.frame(State = January$ShipState)
  teams$Team &lt;- data.frame(Team = January$Team)
  
  logos &lt;- teams %&gt;%
    rowwise() %&gt;%
    mutate(png = switch(Team$Team,
                        &quot;Kansas City Chiefs&quot; = &quot;https://wpcdn.us-east-1.vip.tn-cloud.net/www.koamnewsnow.com/content/uploads/2019/12/17535504_g_23777296_ver1-0.png&quot;,
                        &quot;Alabama Crimson Tide&quot; = &quot;https://seeklogo.com/images/A/alabama-crimson-tide-logo-CBD5086B7E-seeklogo.com.png&quot;,
                        &quot;Phoenix Suns&quot; = &quot;http://assets.stickpng.com/images/58419d52a6515b1e0ad75a6d.png&quot;,
                        &quot;San Francisco 49ers&quot; = &quot;http://assets.stickpng.com/images/580b585b2edbce24c47b2b55.png&quot;, 
                        &quot;Colorado Avalanche&quot; = &quot;http://assets.stickpng.com/images/5a4fbb29da2b4f099b95da0b.png&quot;, 
                        &quot;Tampa Bay Buccaneers&quot; = &quot;http://assets.stickpng.com/thumbs/580b585b2edbce24c47b2b5e.png&quot;, 
                        &quot;Washington Capitals&quot; = &quot;http://assets.stickpng.com/images/5a4fbbeada2b4f099b95da22.png&quot;,
                        &quot;Philadelphia Eagles&quot; = &quot;http://assets.stickpng.com/thumbs/580b585b2edbce24c47b2b4b.png&quot;,
                        &quot;Georgia Bulldogs&quot; = &quot;https://flyclipart.com/thumb2/logo-university-of-georgia-bulldogs-bulldog-head-585520.png&quot;,
                        &quot;Chicago Bears&quot; = &quot;https://cdn.freebiesupply.com/images/large/2x/chicago-bears-logo-transparent.png&quot;, 
                        &quot;Cincinnati Bengals&quot; = &quot;http://assets.stickpng.com/images/580b585b2edbce24c47b2b19.png&quot;, 
                        &quot;New Orleans Saints&quot; = &quot;https://cdn.freebiesupply.com/images/large/2x/new-orleans-saints-logo-transparent.png&quot;,
                        &quot;Baltimore Ravens&quot; = &quot;https://cdn.freebiesupply.com/images/large/2x/baltimore-ravens-logo-transparent.png&quot;,
                        &quot;Minnesota Wild&quot; = &quot;http://assets.stickpng.com/images/5a4fbb61da2b4f099b95da12.png&quot;,
                        &quot;Vegas Golden Knights&quot; = &quot;http://assets.stickpng.com/images/5a4fbbe1da2b4f099b95da21.png&quot;,
                        &quot;Buffalo Bills&quot; = &quot;https://seeklogo.com/images/B/buffalo-bills-logo-8924E7DD74-seeklogo.com.png&quot;,
                        &quot;Pittsburgh Steelers&quot; = &quot;http://assets.stickpng.com/images/580b585b2edbce24c47b2b4e.png&quot;,
                        &quot;Tennessee Titans&quot; = &quot;http://assets.stickpng.com/images/580b585b2edbce24c47b2b61.png&quot;,
                        &quot;Dallas Cowboys&quot;= 'https://cdn.freebiesupply.com/images/large/2x/dallas-cowboys-logo-transparent.png',
                        &quot;Seattle Seahawks&quot; = &quot;https://cdn.freebiesupply.com/images/large/2x/seattle-seahawks-logo-transparent.png&quot;,
                        &quot;Green Bay Packers&quot; = &quot;http://assets.stickpng.com/images/580b585b2edbce24c47b2b25.png&quot;,
                        &quot;West Virginia Mountaineers&quot; = &quot;https://cdn.freebiesupply.com/logos/large/2x/west-virginia-mountaineers-logo-png-transparent.png&quot;,
                        &quot;Arkansas Razorbacks&quot; = &quot;https://upload.wikimedia.org/wikipedia/commons/e/ef/Arkansas-Razorback-Logo-2001.png&quot;,
                        &quot;La Rams&quot; = &quot;http://assets.stickpng.com/images/608968b9d598a5000448eaa2.png&quot;,
                        &quot;Washington Commanders&quot; = &quot;https://loodibee.com/wp-content/uploads/washington-commanders-logo.png&quot;,
                        &quot;Philadelphia 76ers&quot; = &quot;http://assets.stickpng.com/images/58419ca3a6515b1e0ad75a64.png&quot;,
                        &quot;Charlotte Fc&quot; = &quot;https://freetipscout.com/wp-content/uploads/2022/02/sorarecharlottefclogo.png&quot;,
                        &quot;Nebraska Cornhuskers&quot; = &quot;https://cdn.freebiesupply.com/logos/large/2x/nebraska-corn-huskers-logo-png-transparent.png&quot;,
                        &quot;New York Yankees&quot; = &quot;http://assets.stickpng.com/images/584d4b740a44bd1070d5d494.png&quot;,
                        &quot;Oklahoma Sooners&quot; = &quot;https://upload.wikimedia.org/wikipedia/commons/4/49/Oklahoma_Sooners_logo.png&quot;,
                        &quot;Milwaukee Brewers&quot; = &quot;https://purepng.com/public/uploads/large/milwaukee-brewers-logo-9xg.png&quot;,
                        &quot;Los Angeles Dodgers&quot; = &quot;http://assets.stickpng.com/images/584d3e8a0a44bd1070d5d3d7.png&quot;,
                        &quot;Denver Broncos&quot; = &quot;https://cdn.freebiesupply.com/images/large/2x/denver-broncos-logo-transparent.png&quot;,
                        &quot;Washington Nationals&quot; = &quot;https://cdn.freebiesupply.com/images/large/2x/washington-nationals-logo-transparent.png&quot;,
                        &quot;Philadelphia Phillies&quot; = &quot;http://assets.stickpng.com/images/584d42ac0a44bd1070d5d420.png&quot;,
                        &quot;Atlanta Braves&quot; = &quot;https://1000logos.net/wp-content/uploads/2017/08/Atlanta-Braves-logo.png&quot;,
                        &quot;Iowa Hawkeyes&quot; = &quot;https://1000logos.net/wp-content/uploads/2021/06/Iowa-Hawkeyes-logo.png&quot;,
                        &quot;Gonzaga University Bulldogs&quot; = &quot;https://www.pngkey.com/png/full/65-655460_bulldog-700x441-gonzaga-bulldog.png&quot;,
                        &quot;Chicago Cubs&quot; = &quot;http://assets.stickpng.com/images/584d41b10a44bd1070d5d411.png&quot;,
                        &quot;Kentucky Wildcats&quot; = &quot;https://upload.wikimedia.org/wikipedia/commons/5/5d/Kentucky_Wildcats_logo_2015.png&quot;,
                        &quot;Lsu Tigers&quot; = &quot;https://www.nicepng.com/png/full/96-961386_lsu-football-png-transparent-lsu-football-louisiana-state.png&quot;,
                        &quot;Boston Red Sox&quot;= &quot;https://cdn.freebiesupply.com/images/large/2x/boston-red-sox-logo-transparent.png&quot;,
                        &quot;Detroit Tigers&quot; = &quot;https://cdn.freebiesupply.com/images/large/2x/detroit-tigers-logo-transparent.png&quot;,
                        &quot;Minnesota Twins&quot; = &quot;http://assets.stickpng.com/images/584d47ae0a44bd1070d5d45d.png&quot;,
                        &quot;St Louis Cardinals&quot; = &quot;http://assets.stickpng.com/images/584d3fc80a44bd1070d5d3ed.png&quot;,
                        &quot;Mississippi State Bulldogs&quot; = &quot;https://www.nicepng.com/png/detail/71-714091_logo-university-bulldogs-ring-bulldoghead-mississippi-state-university.png&quot;,
                        &quot;Cleveland Browns&quot; = &quot;https://cdn.freebiesupply.com/images/large/2x/cleveland-browns-logo-transparent.png&quot;,
                        &quot;Portland Trailblazers&quot; = &quot;https://cdn.freebiesupply.com/images/large/2x/portland-trail-blazers-logo-transparent.png&quot;,
                        &quot;Masters&quot; = &quot;https://logos-world.net/wp-content/uploads/2022/02/Masters-Symbol.png&quot;,
                        &quot;Tennessee Vols&quot; = &quot;https://1000logos.net/wp-content/uploads/2021/07/Tennessee-Volunteers-logo.png&quot;,
                        &quot;Houston Astros&quot;= &quot;http://assets.stickpng.com/images/584d493b0a44bd1070d5d477.png&quot;,
                        &quot;Utah Jazz&quot; = &quot;http://assets.stickpng.com/images/58419bb6a6515b1e0ad75a55.png&quot;,
                        &quot;La Lakers&quot; = &quot;http://assets.stickpng.com/images/58419d0aa6515b1e0ad75a6c.png&quot;,
                        &quot;Kansas Jayhawks&quot; = &quot;https://brandslogos.com/wp-content/uploads/images/large/kansas-jayhawks-logo.png&quot;,
                        &quot;Baltimore Orioles&quot; = &quot;https://logos-world.net/wp-content/uploads/2020/05/Baltimore-Orioles-Logo-2019-Present.png&quot;,
                        &quot;Unc Tar Heels&quot; = &quot;https://logos-world.net/wp-content/uploads/2021/11/North-Carolina-Tar-Heels-Logo-2005-2014.png&quot;,
                        &quot;South Carolina Gamecocks&quot; = &quot;https://sportslogohistory.com/wp-content/uploads/2018/01/south_carolina_gamecocks_1983-pres_s.png&quot;,
                        &quot;Seattle Mariners&quot; = &quot;http://assets.stickpng.com/images/584d467c0a44bd1070d5d44c.png&quot;,
                        &quot;Colorado Rockies&quot; = &quot;https://www.nicepng.com/png/full/141-1415329_colorado-rockies-logos-png-clipart-download-colorado-rockies.png&quot;,
                        &quot;Golden State Warriors&quot; = &quot;http://assets.stickpng.com/images/58419ce2a6515b1e0ad75a69.png&quot;,
                        &quot;Chicago White Sox&quot; = &quot;http://assets.stickpng.com/images/584d4aff0a44bd1070d5d48d.png&quot;,
                        &quot;Boston Celtics&quot; = &quot;http://assets.stickpng.com/images/58419c6aa6515b1e0ad75a61.png&quot;,
                        &quot;Carolina Hurricanes&quot; = &quot;https://toppng.com/uploads/preview/carolina-hurricanes-nhl-logo-png-11536005105kxafnwdw2o.png&quot;,
                        &quot;Tampa Bay Lightning&quot; = &quot;http://assets.stickpng.com/images/5a4fbbc8da2b4f099b95da1e.png&quot;,
                        &quot;Oregon Ducks&quot; = &quot;https://dejpknyizje2n.cloudfront.net/gallery/Ducks.png&quot;,
                        &quot;Milwaukee Bucks&quot; = &quot;http://assets.stickpng.com/images/58419ba7a6515b1e0ad75a54.png&quot;,
                        &quot;Los Angeles Angels&quot; = &quot;http://assets.stickpng.com/images/584d498d0a44bd1070d5d47b.png&quot;,
                        &quot;Carolina Panthers&quot; = &quot;https://cdn.freebiesupply.com/images/large/2x/carolina-panthers-logo-transparent.png&quot;,
                        &quot;Minnesota Vikings&quot; = &quot;http://assets.stickpng.com/images/580b585b2edbce24c47b2b38.png&quot;,
                        &quot;New England Patriots&quot; = &quot;http://assets.stickpng.com/images/580b585b2edbce24c47b2b3b.png&quot;,
                        &quot;Clemson Tigers&quot; = &quot;http://assets.stickpng.com/images/61487c1ad329bb0004dbd32d.png&quot;,
                        &quot;Wyoming Cowboys&quot; = &quot;https://cdn.freebiesupply.com/logos/large/2x/wyoming-cowboys-logo-png-transparent.png&quot;,
                        &quot;Arizona Cardinals&quot; = &quot;https://cdn.freebiesupply.com/images/large/2x/arizona-cardinals-logo-transparent.png&quot;,
                        &quot;Washington Football Team&quot; = &quot;http://assets.stickpng.com/images/60896cf3d598a5000448eaa8.png&quot;,
                        &quot;Indianapolis Colts&quot; = &quot;http://assets.stickpng.com/images/580b585b2edbce24c47b2b2c.png&quot;,
                        &quot;Detroit Lions&quot; = &quot;https://cdn.freebiesupply.com/images/large/2x/detroit-lions-logo-transparent.png&quot;,
                        &quot;Las Vegas Raiders&quot; = &quot;https://www.pngmart.com/files/16/Las-Vegas-Raiders-Transparent-Background.png&quot;,
                        &quot;Michigan State Spartans&quot; = &quot;http://assets.stickpng.com/images/6103b47a2d29570004bc56f2.png&quot;,
                        &quot;Utah Utes&quot; = &quot;http://assets.stickpng.com/images/5859a2df4f6ae202fedf28ec.png&quot;,
                        &quot;Seattle Kraken&quot; = &quot;https://brandlogos.net/wp-content/uploads/2022/04/seattle_kraken-logo-brandlogos.net_-512x512.png&quot;,
                        &quot;Michigan Wolverines&quot; = &quot;https://upload.wikimedia.org/wikipedia/commons/3/36/Michigan_Wolverines_Block_M.png&quot;
    ))
  
  for (i in seq_len(nrow(logos))) {
    logo &lt;- logos[i, ]
    shape &lt;- states[January$ShipState == logos$State, ]
    
    img &lt;- rasterpic_img(shape, logo$png, mask = TRUE)
    
    plot &lt;- plot + geom_spatraster_rgb(data = img)
  }
  
  plot
  </code></pre>
  <p>The sad and unfortunate problem here is that my current map output looks like this:</p>
  <p><a href="https://i.stack.imgur.com/m4Imc.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/m4Imc.jpg" alt="Where you can see the images are far too large." /></a></p>
  <p>All of this should be fitting more like the sample photo. What's going on?</p>
  <p>Current dataset January:</p>
  <pre><code>    ShipState   Team
  AL  Alabama Crimson Tide
  AR  Kansas City Chiefs
  AZ  Phoenix Suns
  CA  San Francisco 49ers
  CO  Colorado Avalanche
  CT  Tampa Bay Buccaneers
  DE  Philadelphia Eagles
  FL  Tampa Bay Buccaneers
  GA  Georgia Bulldogs
  IA  Kansas City Chiefs
  ID  San Francisco 49ers
  IL  Chicago Bears
  IN  Cincinnati Bengals
  KS  Kansas City Chiefs
  KY  Cincinnati Bengals
  LA  New Orleans Saints
  MA  Tampa Bay Buccaneers
  MD  Baltimore Ravens
  ME  Tampa Bay Buccaneers
  </code></pre>