Unconfigured Ad

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jon17
    Member
    • Jun 2016
    • 15

    #1

    plotting 5 million points in R

    I plotted 5 million points in R. Is there a way to clean this up? Make it easier to spot patterns?

  • Jon17
    Member
    • Jun 2016
    • 15

    #2
    I'd like to reproduce this but don't know how:

    Comment

    • dpryan
      Devon Ryan
      • Jul 2011
      • 3478

      #3
      I would recommend using something like geom_tile() or geom_raster() in ggplot2 rather than plotting the actual points. That will make it vastly simpler to spot trends.

      Comment

      • Jon17
        Member
        • Jun 2016
        • 15

        #4
        geom_raster looks really nice!

        Unfortunately I only have 2 data columns. Looks like geom_raster requires 3 columns? the faithfuld plot used in the example link below has 3 columns in it,

        1) waiting
        2) eruptions
        3) density

        all 3 are used to create the plot. Can you apply this to 2 column data?

        Comment

        • dpryan
          Devon Ryan
          • Jul 2011
          • 3478

          #5
          Ah, right, try geom_density_2d() instead.

          Comment

          • Jon17
            Member
            • Jun 2016
            • 15

            #6
            Thanks for the tip, but now I'm having the opposite problem. The plots are too spars. Either the whole plot is colored or almost nothing at all. :-p

            Comment

            • Brian Bushnell
              Super Moderator
              • Jan 2014
              • 2709

              #7
              Maybe this is too obvious, but have you tried randomly subsampling?

              Comment

              • Jon17
                Member
                • Jun 2016
                • 15

                #8
                That worked.... thanks! duh... :-)

                I read threads of people plotting millions of datapoints so I just assumed R could handle it easily. Looks like 100k to 1 M is the perfect range for pch='.'

                Comment

                • gringer
                  David Eccles (gringer)
                  • May 2011
                  • 845

                  #9
                  You can also use smoothscatter, which plots a smoothed contour plus points for any outliers

                  Comment

                  • thermophile
                    Senior Member
                    • Apr 2015
                    • 243

                    #10
                    If you want to plot the actual points, play with alpha (transparancy) using one of the solid shapes (15-20). R can certainly handle it just be aware that the file will be huge.
                    Microbial ecologist, running a sequencing core. I have lots of strong opinions on how to survey communities, pretty sure some are even correct.

                    Comment

                    • gringer
                      David Eccles (gringer)
                      • May 2011
                      • 845

                      #11
                      Originally posted by thermophile View Post
                      R can certainly handle it just be aware that the file will be huge.
                      If you output a PNG file rather than an SVG or PDF file, then the output file will not be huge. It just won't have as much information in it, and won't be infinitely scalable.

                      Comment

                      Latest Articles

                      Collapse

                      • kinpict.com
                        Reply to 16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
                        by kinpict.com
                        The part about this topic feels surprisingly grounded, and the details on the page is the bit that made me slow down. I’d keep <a href="https://kinpict.com/">ai family photo generator</a> bookmarked for later.
                        Today, 06:37 PM
                      • SEQadmin2
                        16S/ITS Profiling vs. Shotgun Metagenomics: What Changes in Your Workflow?
                        by SEQadmin2





                        NGS has revolutionized clinical microbiology by offering new ways to identify and surveil pathogens without prior knowledge of the target. One popular approach is 16S rRNA and ITS amplicon sequencing, which targets specific microbial markers. But studies are increasingly incorporating shotgun metagenomics, a technique that sequences all DNA from a sample without targeting specific microbial markers. This approach allows more detailed taxonomic classification,...
                        10-30-2026, 06:46 AM

                      ad_right_rmr

                      Collapse

                      News

                      Collapse

                      Topics Statistics Last Post
                      Started by SEQadmin2, 11-12-2026, 07:59 AM
                      0 responses
                      27 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 11-05-2026, 09:25 AM
                      0 responses
                      35 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 11-03-2026, 11:54 AM
                      2 responses
                      56 views
                      0 reactions
                      Last Post kinpict.com  
                      Started by SEQadmin2, 10-28-2026, 09:57 AM
                      0 responses
                      175 views
                      0 reactions
                      Last Post SEQadmin2  
                      Working...