Giter Site home page Giter Site logo

Comments (11)

lwasser avatar lwasser commented on May 23, 2024

Hi Kristina! Thank you for working on this today :) i think i took care of the merge conflicts. have a look at the file to make sure all looks ok!

Do you know how to update your branch BEFORE doing a pull request. Or the other option is that you can work directly in the repo if you want to do that. whatever you prefer. then you don't have to do a pull request. totally up to you how you'd like to work. Just say the word if you need further explanation! :)

i will look at the lesson tomorrow and see if i have ideas in terms of what to include.

i have the same question as you about the image vs plot. i know there are some differences in terms of how the axes render, etc... but maybe someone else knows more? pinging @jhollist @bbest ?? image vs plot anyone know how they differ?

from r-raster-vector-geospatial.

bbest avatar bbest commented on May 23, 2024

Note that when you look for help on plot (ie type ?plot at the command prompt) and you already have the raster package already loaded (ie library(raster)), then you're presented with help documentation on functions from two different packages:

Similarly with ?image:

The graphics library is a base package, and raster an add-on. Following the links to documentation above, especially raster::image yields the best summary of differences:

This is an implementation of a generic function in the graphics package. In most cases the plot function would be preferable because it produces a legend (and has some additional options).

from r-raster-vector-geospatial.

jhollist avatar jhollist commented on May 23, 2024

What @bbest said!

To add, plot will handle colormaps (if they exist) and image won't. There also can be a performance hit on image if you are limiting the x or y axis. IMO, plot is preferable and for this lesson in which we use raster sticking with plot makes the most sense.

from r-raster-vector-geospatial.

KristinaRiemer avatar KristinaRiemer commented on May 23, 2024

Thanks for all the helpful and prompt comments y'all!

@lwasser I definitely forgot to update my branch! I'm still getting used to the collaborative workflow in Github, which is why I would kind of prefer to do pull requests instead of changing the repo directly, if that's okay? This adds another step, but I can accept my pull requests myself so that it's not a hassle for anyone else.

@bbest and @jhollist My intuition was to just use plot for this lesson, so I'm glad you both seem to concur.

During the hackathon, we discussed whether or not to explain the difference between the base R plot and the raster plot functions during the lesson. Does that seem important/a good use of time to people? I'm starting to think it might be a good idea so that people aren't confused about the multiple options when they use ?plot.

from r-raster-vector-geospatial.

jhollist avatar jhollist commented on May 23, 2024

@KristinaRiemer I think it is OK to mention this but more as an abstract concept, as we don't want to get into the details of OOP in R. I wouldn't be able to help too much with that anyway, as I don't know a whole lot. Plus from what I hear it is a bit of a mess.

I think you can say something about many functions (including plot) often have specific implementations written for specific packages. As long as you have the package loaded into the current session R will know which version of plot to use. Perhaps we could show the error that occurs if you try to plot a raster object without having raster loaded up. Something like

rast_obj<-raster::raster("file.tif")
plot(rast_obj)

should do the trick and will return the "cannot coerce type 'S4' to vector of type 'double'" error. If they know about that it should hopefully server as reminder to library(raster).

from r-raster-vector-geospatial.

KristinaRiemer avatar KristinaRiemer commented on May 23, 2024

@jhollist That's about the level of detail we were thinking about, including trying to plot a raster with the base plot. As @brymz had brought up, it seems like something general that everyone who codes in R should be aware of.

I'll incorporate that into the lesson when I get a chance next week. Thanks!

from r-raster-vector-geospatial.

lwasser avatar lwasser commented on May 23, 2024

Thank you @KristinaRiemer - whatever work flow is good for you, is good for me! :) it will be useful to fork and work remotely to learn more about collaboration in git! Let me know if you run into any other issues. It's much easier to resolve merge conflicts using shell / command line. Very happy to walk you through some of the basics IF at some point you'd like to do that :) Thank you again for the help with this.

I'm going to have a look at the lessons again and will post another issue about plot vs ggplot2. I'm almost thinking it's worth introducing ggplot somewhere early in the workshop materials. But i want everyone's input on this! I get it's a very different syntax approach but it's also very powerful and efficient for mapping from what i can tell so far.

from r-raster-vector-geospatial.

lwasser avatar lwasser commented on May 23, 2024

Hi @KristinaRiemer ! a quick update!
I went through the plot rasters lesson and added a hill shade exercise at the end (overlaying one raster over another and adding transparency. See what you think and feel free to edit away!

http://data-lessons.github.io/NEON-R-Spatial-Raster/R/Plot-Rasters-In-R.R/

I thought that would be cool because then in lesson 02 (a new lesson) i added something on reprojection and used the same set of data and same plotting techniques HOWEER one of the hillshades is in the wrong projection. So it doesn't line up! It's a nice way to reinforce plotting in the following lesson but also introduce projection issues. Anyway - see what you think, when you have time!

from r-raster-vector-geospatial.

KristinaRiemer avatar KristinaRiemer commented on May 23, 2024

@lwasser I like the hill shade overlay added to this lesson. Where can I get the hill shade raster file? (I don't think it's in the figshare).

I'm wondering a bit about the use of "overlay" between lessons 01 and 03. In lesson 01, this means to put a raster on top of another visually, while in lesson 03 overlay means doing math using two rasters. This might be unnecessarily picky, but I could see how this might confuse participants.

from r-raster-vector-geospatial.

lwasser avatar lwasser commented on May 23, 2024

@KristinaRiemer totally not picky -- good point. It will be confusing.

Hmmm... language. what language should we use then to stack two rasters on top of each other like we do in the hillshade? Any ideas?

Also - the hillshade is in the most current figshare download! Thank you for noting this.

http://files.figshare.com/2434040/NEON_RemoteSensing.zip

from r-raster-vector-geospatial.

brymz avatar brymz commented on May 23, 2024

Is an image that represents multiple bands a 'composite' image? 'Stack' is also a potential good option.

from r-raster-vector-geospatial.

Related Issues (20)

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.