Visualizing Histogram of cell-specific values across layers of RasterStack using R? [closed] Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Using histogram in ArcGIS 10 with dates and sum of valuesHistogram Matching using Python to improve mosaicking process of multiple overlapping rasters?replace raster cell values with values in a .csvHow to add a layer on a RasterStack in a specific position?Keeping original cell values when replacing NA values using nearest neighbour with focal function of R?Extract values from large rasterstack, RAccessing raster values to create histogram using ArcPy?Values on top of each bar of a histogram in QGISSetting pixels of a all raster layers in a raster stack to NA based on the pixel values of corresponding raster layers of another raster stackSubsetting rasterstack for subtraction between elements using R?

Where did Ptolemy compare the Earth to the distance of fixed stars?

Noise in Eigenvalues plot

Short story about astronauts fertilizing soil with their own bodies

Understanding piped commands in GNU/Linux

What was the last profitable war?

Why complex landing gears are used instead of simple, reliable and light weight muscle wire or shape memory alloys?

Determine whether an integer is a palindrome

Number of generators of subgroup

2018 MacBook Pro won't let me install macOS High Sierra 10.13 from USB installer

What is the proper term for etching or digging of wall to hide conduit of cables

Vertical ranges of Column Plots in 12

Table formatting with tabularx?

How does the body cool itself in a stillsuit?

Why do C and C++ allow the expression (int) + 4*5;

Did John Wesley plagiarize Matthew Henry...?

Should man-made satellites feature an intelligent inverted "cow catcher"?

Does the main washing effect of soap come from foam?

Random body shuffle every night—can we still function?

One-one communication

Why did Bronn offer to be Tyrion Lannister's champion in trial by combat?

Why are current probes so expensive?

Can the Haste spell grant both a Beast Master ranger and their animal companion extra attacks?

How do you write "wild blueberries flavored"?

Centre cell vertically in tabularx



Visualizing Histogram of cell-specific values across layers of RasterStack using R? [closed]



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Using histogram in ArcGIS 10 with dates and sum of valuesHistogram Matching using Python to improve mosaicking process of multiple overlapping rasters?replace raster cell values with values in a .csvHow to add a layer on a RasterStack in a specific position?Keeping original cell values when replacing NA values using nearest neighbour with focal function of R?Extract values from large rasterstack, RAccessing raster values to create histogram using ArcPy?Values on top of each bar of a histogram in QGISSetting pixels of a all raster layers in a raster stack to NA based on the pixel values of corresponding raster layers of another raster stackSubsetting rasterstack for subtraction between elements using R?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















Working in R. I have rasterstacks of temperature / precipitation data for particular countries and agricultural seasons. For instance, a rasterstack of daily noon temperature for the growing season only, for 2011, covering Ethiopia only. That particular rasterstack would be 275 layers, since the growing season is 275 days.



I'd like to examine histograms of the cell-specific values across layers. That is, I want to see the rain / temp distribution that occurs within a season, over days, for any given location. I'm not wondering about a particular cell; I'd like to be able to quickly visualize these histograms for a bunch of different cells.



How would I do this?










share|improve this question















closed as unclear what you're asking by Spacedman, Vince, Jochen Schwarze, whyzar, Simbamangu Apr 15 at 14:39


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 1





    What does "any given location" in your last paragraph mean if it doesn't mean "a particular cell"?

    – Spacedman
    Apr 12 at 22:45

















0















Working in R. I have rasterstacks of temperature / precipitation data for particular countries and agricultural seasons. For instance, a rasterstack of daily noon temperature for the growing season only, for 2011, covering Ethiopia only. That particular rasterstack would be 275 layers, since the growing season is 275 days.



I'd like to examine histograms of the cell-specific values across layers. That is, I want to see the rain / temp distribution that occurs within a season, over days, for any given location. I'm not wondering about a particular cell; I'd like to be able to quickly visualize these histograms for a bunch of different cells.



How would I do this?










share|improve this question















closed as unclear what you're asking by Spacedman, Vince, Jochen Schwarze, whyzar, Simbamangu Apr 15 at 14:39


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • 1





    What does "any given location" in your last paragraph mean if it doesn't mean "a particular cell"?

    – Spacedman
    Apr 12 at 22:45













0












0








0








Working in R. I have rasterstacks of temperature / precipitation data for particular countries and agricultural seasons. For instance, a rasterstack of daily noon temperature for the growing season only, for 2011, covering Ethiopia only. That particular rasterstack would be 275 layers, since the growing season is 275 days.



I'd like to examine histograms of the cell-specific values across layers. That is, I want to see the rain / temp distribution that occurs within a season, over days, for any given location. I'm not wondering about a particular cell; I'd like to be able to quickly visualize these histograms for a bunch of different cells.



How would I do this?










share|improve this question
















Working in R. I have rasterstacks of temperature / precipitation data for particular countries and agricultural seasons. For instance, a rasterstack of daily noon temperature for the growing season only, for 2011, covering Ethiopia only. That particular rasterstack would be 275 layers, since the growing season is 275 days.



I'd like to examine histograms of the cell-specific values across layers. That is, I want to see the rain / temp distribution that occurs within a season, over days, for any given location. I'm not wondering about a particular cell; I'd like to be able to quickly visualize these histograms for a bunch of different cells.



How would I do this?







r histogram rasterstack






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 12 at 20:56









PolyGeo

54.1k1782246




54.1k1782246










asked Apr 12 at 18:00









Leah BevisLeah Bevis

356




356




closed as unclear what you're asking by Spacedman, Vince, Jochen Schwarze, whyzar, Simbamangu Apr 15 at 14:39


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









closed as unclear what you're asking by Spacedman, Vince, Jochen Schwarze, whyzar, Simbamangu Apr 15 at 14:39


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.









  • 1





    What does "any given location" in your last paragraph mean if it doesn't mean "a particular cell"?

    – Spacedman
    Apr 12 at 22:45












  • 1





    What does "any given location" in your last paragraph mean if it doesn't mean "a particular cell"?

    – Spacedman
    Apr 12 at 22:45







1




1





What does "any given location" in your last paragraph mean if it doesn't mean "a particular cell"?

– Spacedman
Apr 12 at 22:45





What does "any given location" in your last paragraph mean if it doesn't mean "a particular cell"?

– Spacedman
Apr 12 at 22:45










1 Answer
1






active

oldest

votes


















0














Use the extract() function to find all values associated with a particular location, and visualize with hist(). Your raster's projection and extent will determine what points you want to use for PointOfInterest. A reproducible example:



library(raster)
r1 = raster(matrix(c(1:25),
nrow=5,ncol=5))
r2 = raster(matrix(rep(5, 25),
nrow=5,ncol=5))
r3 = raster(matrix(c(35:11),
nrow=5,ncol=5))
r_stack = stack(r1,r2,r3)
extent(r_stack) # Bounded by (0,1) in both dimensions

PointOfInterest = matrix(data=c(0.1,0.1),
ncol=2)
myValues = extract(x = r_stack,
y = PointOfInterest)

hist(myValues)


If you want to do this with more than one point, you can add rows to the matrix with coordinates you're interested in, or use raster::sampleRandom() to randomly choose points. Then you just need to format the graphical parameters accordingly:



randomvals = sampleRandom(r_stack,
size = 4)
randomvals # This did the extracting for us

# Set up paneling so you can look at a bunch of histograms at once
n.points = nrow(randomvals)
par(mfrow=c(ceiling(n.points/2),2))
# Create a histogram for each point
for(i in 1:n.points)
hist(randomvals[i,])






share|improve this answer































    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Use the extract() function to find all values associated with a particular location, and visualize with hist(). Your raster's projection and extent will determine what points you want to use for PointOfInterest. A reproducible example:



    library(raster)
    r1 = raster(matrix(c(1:25),
    nrow=5,ncol=5))
    r2 = raster(matrix(rep(5, 25),
    nrow=5,ncol=5))
    r3 = raster(matrix(c(35:11),
    nrow=5,ncol=5))
    r_stack = stack(r1,r2,r3)
    extent(r_stack) # Bounded by (0,1) in both dimensions

    PointOfInterest = matrix(data=c(0.1,0.1),
    ncol=2)
    myValues = extract(x = r_stack,
    y = PointOfInterest)

    hist(myValues)


    If you want to do this with more than one point, you can add rows to the matrix with coordinates you're interested in, or use raster::sampleRandom() to randomly choose points. Then you just need to format the graphical parameters accordingly:



    randomvals = sampleRandom(r_stack,
    size = 4)
    randomvals # This did the extracting for us

    # Set up paneling so you can look at a bunch of histograms at once
    n.points = nrow(randomvals)
    par(mfrow=c(ceiling(n.points/2),2))
    # Create a histogram for each point
    for(i in 1:n.points)
    hist(randomvals[i,])






    share|improve this answer





























      0














      Use the extract() function to find all values associated with a particular location, and visualize with hist(). Your raster's projection and extent will determine what points you want to use for PointOfInterest. A reproducible example:



      library(raster)
      r1 = raster(matrix(c(1:25),
      nrow=5,ncol=5))
      r2 = raster(matrix(rep(5, 25),
      nrow=5,ncol=5))
      r3 = raster(matrix(c(35:11),
      nrow=5,ncol=5))
      r_stack = stack(r1,r2,r3)
      extent(r_stack) # Bounded by (0,1) in both dimensions

      PointOfInterest = matrix(data=c(0.1,0.1),
      ncol=2)
      myValues = extract(x = r_stack,
      y = PointOfInterest)

      hist(myValues)


      If you want to do this with more than one point, you can add rows to the matrix with coordinates you're interested in, or use raster::sampleRandom() to randomly choose points. Then you just need to format the graphical parameters accordingly:



      randomvals = sampleRandom(r_stack,
      size = 4)
      randomvals # This did the extracting for us

      # Set up paneling so you can look at a bunch of histograms at once
      n.points = nrow(randomvals)
      par(mfrow=c(ceiling(n.points/2),2))
      # Create a histogram for each point
      for(i in 1:n.points)
      hist(randomvals[i,])






      share|improve this answer



























        0












        0








        0







        Use the extract() function to find all values associated with a particular location, and visualize with hist(). Your raster's projection and extent will determine what points you want to use for PointOfInterest. A reproducible example:



        library(raster)
        r1 = raster(matrix(c(1:25),
        nrow=5,ncol=5))
        r2 = raster(matrix(rep(5, 25),
        nrow=5,ncol=5))
        r3 = raster(matrix(c(35:11),
        nrow=5,ncol=5))
        r_stack = stack(r1,r2,r3)
        extent(r_stack) # Bounded by (0,1) in both dimensions

        PointOfInterest = matrix(data=c(0.1,0.1),
        ncol=2)
        myValues = extract(x = r_stack,
        y = PointOfInterest)

        hist(myValues)


        If you want to do this with more than one point, you can add rows to the matrix with coordinates you're interested in, or use raster::sampleRandom() to randomly choose points. Then you just need to format the graphical parameters accordingly:



        randomvals = sampleRandom(r_stack,
        size = 4)
        randomvals # This did the extracting for us

        # Set up paneling so you can look at a bunch of histograms at once
        n.points = nrow(randomvals)
        par(mfrow=c(ceiling(n.points/2),2))
        # Create a histogram for each point
        for(i in 1:n.points)
        hist(randomvals[i,])






        share|improve this answer















        Use the extract() function to find all values associated with a particular location, and visualize with hist(). Your raster's projection and extent will determine what points you want to use for PointOfInterest. A reproducible example:



        library(raster)
        r1 = raster(matrix(c(1:25),
        nrow=5,ncol=5))
        r2 = raster(matrix(rep(5, 25),
        nrow=5,ncol=5))
        r3 = raster(matrix(c(35:11),
        nrow=5,ncol=5))
        r_stack = stack(r1,r2,r3)
        extent(r_stack) # Bounded by (0,1) in both dimensions

        PointOfInterest = matrix(data=c(0.1,0.1),
        ncol=2)
        myValues = extract(x = r_stack,
        y = PointOfInterest)

        hist(myValues)


        If you want to do this with more than one point, you can add rows to the matrix with coordinates you're interested in, or use raster::sampleRandom() to randomly choose points. Then you just need to format the graphical parameters accordingly:



        randomvals = sampleRandom(r_stack,
        size = 4)
        randomvals # This did the extracting for us

        # Set up paneling so you can look at a bunch of histograms at once
        n.points = nrow(randomvals)
        par(mfrow=c(ceiling(n.points/2),2))
        # Create a histogram for each point
        for(i in 1:n.points)
        hist(randomvals[i,])







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 13 at 0:46

























        answered Apr 12 at 22:56









        JepsonNomadJepsonNomad

        578515




        578515













            Popular posts from this blog

            រឿង រ៉ូមេអូ និង ហ្ស៊ុយលីយេ សង្ខេបរឿង តួអង្គ បញ្ជីណែនាំ

            Crop image to path created in TikZ? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)Crop an inserted image?TikZ pictures does not appear in posterImage behind and beyond crop marks?Tikz picture as large as possible on A4 PageTransparency vs image compression dilemmaHow to crop background from image automatically?Image does not cropTikzexternal capturing crop marks when externalizing pgfplots?How to include image path that contains a dollar signCrop image with left size given

            Romeo and Juliet ContentsCharactersSynopsisSourcesDate and textThemes and motifsCriticism and interpretationLegacyScene by sceneSee alsoNotes and referencesSourcesExternal linksNavigation menu"Consumer Price Index (estimate) 1800–"10.2307/28710160037-3222287101610.1093/res/II.5.31910.2307/45967845967810.2307/2869925286992510.1525/jams.1982.35.3.03a00050"Dada Masilo: South African dancer who breaks the rules"10.1093/res/os-XV.57.1610.2307/28680942868094"Sweet Sorrow: Mann-Korman's Romeo and Juliet Closes Sept. 5 at MN's Ordway"the original10.2307/45957745957710.1017/CCOL0521570476.009"Ram Leela box office collections hit massive Rs 100 crore, pulverises prediction"Archived"Broadway Revival of Romeo and Juliet, Starring Orlando Bloom and Condola Rashad, Will Close Dec. 8"Archived10.1075/jhp.7.1.04hon"Wherefore art thou, Romeo? To make us laugh at Navy Pier"the original10.1093/gmo/9781561592630.article.O006772"Ram-leela Review Roundup: Critics Hail Film as Best Adaptation of Romeo and Juliet"Archived10.2307/31946310047-77293194631"Romeo and Juliet get Twitter treatment""Juliet's Nurse by Lois Leveen""Romeo and Juliet: Orlando Bloom's Broadway Debut Released in Theaters for Valentine's Day"Archived"Romeo and Juliet Has No Balcony"10.1093/gmo/9781561592630.article.O00778110.2307/2867423286742310.1076/enst.82.2.115.959510.1080/00138380601042675"A plague o' both your houses: error in GCSE exam paper forces apology""Juliet of the Five O'Clock Shadow, and Other Wonders"10.2307/33912430027-4321339124310.2307/28487440038-7134284874410.2307/29123140149-661129123144728341M"Weekender Guide: Shakespeare on The Drive""balcony"UK public library membership"romeo"UK public library membership10.1017/CCOL9780521844291"Post-Zionist Critique on Israel and the Palestinians Part III: Popular Culture"10.2307/25379071533-86140377-919X2537907"Capulets and Montagues: UK exam board admit mixing names up in Romeo and Juliet paper"Istoria Novellamente Ritrovata di Due Nobili Amanti2027/mdp.390150822329610820-750X"GCSE exam error: Board accidentally rewrites Shakespeare"10.2307/29176390149-66112917639"Exam board apologises after error in English GCSE paper which confused characters in Shakespeare's Romeo and Juliet""From Mariotto and Ganozza to Romeo and Guilietta: Metamorphoses of a Renaissance Tale"10.2307/37323537323510.2307/2867455286745510.2307/28678912867891"10 Questions for Taylor Swift"10.2307/28680922868092"Haymarket Theatre""The Zeffirelli Way: Revealing Talk by Florentine Director""Michael Smuin: 1938-2007 / Prolific dance director had showy career"The Life and Art of Edwin BoothRomeo and JulietRomeo and JulietRomeo and JulietRomeo and JulietEasy Read Romeo and JulietRomeo and Julieteeecb12003684p(data)4099369-3n8211610759dbe00d-a9e2-41a3-b2c1-977dd692899302814385X313670221313670221