Giter Club home page Giter Club logo

rayshader_portraits's Introduction

About

This repo houses code I use to create shaded relief graphics using the rayshader R package by Tyler Morgan-Wall. I'm walking in the giant steps of Twitter user flotsam whose graphics originally inspired me, and tips + code snippets they shared helped immensely as I was just learning how to make these.

I've been making these graphics for a while (see my gallery) and wanted to share code from the start, but I was self-conscious about the state of my code. This repo is an effort to better organize my code so I can be confident in sharing it.

Repo Structure

Code to create each graphic has its own directory within the R/portraits directory, and helper functions can be found in the R/utils directory.

Graphics are written to an images directory, but I'm not tracking it here because the graphics tend to be pretty large files. Instead, I copy the smaller version of the graphics (created for posting to platforms like Instagram or Reddit where file size limits are enforced) to the tracked_graphics directory so there is something to showcase here.

Workflow

Here's a sample workflow you could use to repurpose this code for your own geography (assuming you've forked or otherwise copied this directory):

  1. Call .new_portrait() to start work on a portrait. This function takes one argument, which is the name of the map.
    • If it is based on a US National Park, the name will be used to filter the master list of park geometries for the one you specified in the function call.
    • This function will create a new directory within R/portraits, with the directory name determined by map argument in the the function call.
    • .new_portrait() is loaded whenever you open the project via the .Rprofile file, but it remains hidden from the environment because its name begins with a leading period.
  2. Run the code in the render_graphic.R file, an example of which is R/portraits/bryce_canyon/render_graphic.R.
    • If you're changing things up at all, this will be an iterative process.
    • Start with a lower z value so you're working with less data, and it's easier to iterate as you work to to get everything set how you want it.
    • When you're ready to render the final graphic, bump it up to the highest resolution you want.
  3. Run the code in markup.R (e.g. R/portraits/bryce_canyon/markup.R), adjusting the code as necessary for your given scenario.
    • The code is structured to allow for aligning text, but currently I have only built it out to allow for center aligned. Aligning to left or right will involve handling those settings by setting {magick}'s gravity argument to 'west' or 'east', and then adjusting the coords accordingly. You could achieve this directly with {magick} as well if you want more direct control.
    • I'm making improvements to the utils functions as I go, so earlier render and markup scripts might need updating to work with new functions. I am not maintaining backwards compatibility.
  4. The code as I've written it will save two files, one at a higher resolution, and one at a lower resolution that should fall under the limits for sites like Instagram and Reddit.

Graphics

New Mexico Population Density

New Mexico Population Density

Tennessee Population Density

Tennessee Population Density

Colorado Population Density

Colorado Population Density

South Dakota Population Density

South Dakota Population Density

North Dakota Population Density

North Dakota Population Density

Rhode Island Population Density

Rhode Island Population Density

Connecticut Population Density

Connecticut Population Density

New Hampshire Population Density

New Hampshire Population Density

Delaware Population Density

Delaware Population Density

East Coast Population Density

East Coast Population Density

West Coast Population Density

West Coast Population Density

Great Lakes Population Density

Great Lakes Population Density

New York Population Density

New York Population Density

Kansas Population Density

Kansas Population Density

North Carolina Population Density

North Carolina Population Density

Alaska Population Density

Alaska Population Density

Maine Population Density

Maine Population Density

Maryland Population Density

Maryland Population Density

Montana Population Density

Montana Population Density

Vermont Population Density

Vermont Population Density

Massachusetts Population Density

Massachusetts Population Density

Massachusetts Population Density

Massachusetts Population Density

Hawaii Population Density

Hawaii Population Density

Florida Population Density (Again)

Florida Population Density

Nevada Population Density

Nevada Population Density

Arkansas Population Density

Arkansas Population Density

Texas Cities Population Density

Texas Cities Population Density

Texas Population Density

Texas Population Density

Wyoming Population Density

Wyoming Population Density

Alabama Population Density

Alabama Population Density

West Virginia Population Density

West Virginia Population Density

Missouri Population Density

Missouri Population Density

Utah Population Density

Utah Population Density

Nebraska Population Density

Nebraska Population Density

Oklahoma Population Density

Oklahoma Population Density

Wisconsin Population Density

Wisconsin Population Density

Young Stellar Object

Young Stellar Object

California Population Density

California Population Density

Comparative Population Density: Seattle and Phoenix

Comparative Population Density: Seattle and Phoenix

Grand Canyon Rims

Grand Canyon Rims

Louisiana Population Density

Louisiana Population Density

Louisiana Parade Population Density

Louisiana Parade Population Density

Iowa Population Density

Iowa Population Density

New Jersey Population Density

New Jersey Population Density

Kentucky Population Density

Kentucky Population Density

Idaho Population Density

Idaho Population Density

Comparative Population Density: Cincinnati and Kansas City

Comparative Population Density: Cincinnati and Kansas City

Comparative Population Density: Philadelphia and San Francisco

Comparative Population Density: Philadelphia and San Francisco

Population Density along Interstate 95

Population Density along Interstate 95

Comparative Population Density: Chicago and NYC

Comparative Population Density: Chicago and NYC

New York Population Density

New York Population Density

South Carolina Population Density

South Carolina Population Density

Oregon Population Density

Oregon Population Density

Comparative Population Density: St. Louis and Milwaukee

Comparative Population Density: St. Louis and Milwaukee

Indiana Population Density

Indiana Population Density

Densité de population le long de la Seine et la Tamise

Densité de population le long de la Seine et la Tamise

Population Density along the Seine and Thames Rivers

Population Density along the Seine and Thames Rivers

Population Density along the Thames

Population Density along the Thames

Densité de population le long de la Seine

Densité de population le long de la Seine

Population Density along the River Seine

Population Density along the River Seine

Arizona Population Density

Arizona Population Density

New England Population Density

New England Population Density

Mississippi Population Density

Mississippi Population Density

Lake Geneva Population Density

titled.mp4

Washington Population Density

Washington Population Density

Mediterranean Coast Population Density

Mediterranean Coast Population Density

Illinois Population Density

Illinois Population Density

Kansas Population Density

Kansas Population Density

Amazon River Population Density

Amazon River Population Density

Virginia Population Density

Virginia Population Density

Pennsylvania Population Density

Pennsylvania Population Density

Ohio Population Density

Ohio Population Density

Georgia Population Density

Georgia Population Density

The Nile Population Density

The Nile Population Density

North Carolina Population Density

North Carolina Population Density

Minnesota Population Density

Minnesota Population Density

Colorado River Population Density

Colorado River Population Density

Michigan Population Density

Michigan Population Density

Death Valley

Death Valley

Pillars of Creation

Pillars of Creation

Pillars of Creation

Pillars of Creation

Pillars of Creation

Pillars of Creation

Pillars of Creation

Pillars of Creation

Pillars of Creation

Pillars of Creation

Pillars of Creation

Pillars of Creation

Mount Katmai

Mount Katmai

Katmai National Park

Katmai National Park

Kobuk Valley National Park

Kobuk Valley National Park

Voyageurs National Park

Voyageurs National Park

Voyageurs National Park

Voyageurs National Park

Voyageurs National Park

Voyageurs National Park

Washington National Parks

Washington National Parks

North Cascades National Park

North Cascades National Park

Mount Rainier National Park

Mount Rainier National Park

Olympic National Park

Olympic National Park

Congaree National Park

Congaree National Park

Badlands National Park

Badlands National Park

Mighty Five National Parks of Utah

Mighty Five National Parks of Utah

Bryce Canyon National Park

Bryce Canyon National Park

Zion National Park

Zion National Park

Arches National Park

Arches National Park

Canyonlands National Park

Canyonlands National Park

Capitol Reef National Park

Capitol Reef National Park

Crater of Vélingara

Crater of Vélingara

Eye of the Sahara

Eye of the Sahara

Great Basin

Great Basin

San Andreas Fault at Temblor Range

San Andreas Fault at Temblor Range

Glacier National Park

Glacier National Park

Glacier National Park

Glacier National Park

Kings Canyon National Park

Kings Canyon National Park

Interstate 70

Interstate 70

Sequoia National Park

Sequoia National Park

Great Smoky Mountains

Great Smoky Mountains

Bryce Canyon

Bryce Canyon

rayshader_portraits's People

Contributors

pecners avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.