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

                      • SEQadmin2
                        Multiomic Liquid Biopsy: What DNA/RNA Panels Reveal That DNA Alone Can’t
                        by SEQadmin2



                        Tumors contain complex mixtures of cell populations that evolve in response to treatment and host-specific factors. Tissue biopsies provide only static snapshots of a tumor’s state. But what if we could follow that evolution over time using a minimally invasive technique?

                        Liquid biopsies can detect tumor-derived material circulating in the bloodstream, providing a way to study treatment response, detect emerging resistance, and discover new biomarkers. Circulating
                        ...
                        10-14-2026, 09:55 AM
                      • SEQadmin2
                        New Genomics Technologies Take Aim at Long-Standing Limits
                        by SEQadmin2


                        Researchers using sequencing and genomics tools often have to make trade-offs. They can choose between speed or scale, short reads or long-range information, or targeted panels or a view of the whole transcriptome. New technologies that have been released this year are built to address those tough choices.

                        We asked six companies the same four questions to learn about their latest products. The new technologies bring a lot to the table, including rethinking sequencing
                        ...
                        09-28-2026, 10:25 AM

                      ad_right_rmr

                      Collapse

                      News

                      Collapse

                      Topics Statistics Last Post
                      Started by SEQadmin2, Yesterday, 11:13 AM
                      0 responses
                      16 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, Yesterday, 10:48 AM
                      0 responses
                      17 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 10-15-2026, 10:52 AM
                      0 responses
                      35 views
                      0 reactions
                      Last Post SEQadmin2  
                      Started by SEQadmin2, 10-14-2026, 05:39 AM
                      0 responses
                      42 views
                      0 reactions
                      Last Post SEQadmin2  
                      Working...