Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is a great problem for <code>ggplot2</code>. </p> <p>First, read the data in:</p> <pre><code>snb &lt;- read.csv('MLB.csv') </code></pre> <p>With your data frame you could try plotting points that are partly transparent, and setting them to be colored according to the factor <code>event_type</code>:</p> <pre><code>require(ggplot2) p1 &lt;- ggplot(data = snb, aes(x = px, y = py, color = event_type)) + geom_point(alpha = 0.5) print(p1) </code></pre> <p>and then you get this:</p> <p><img src="https://i.stack.imgur.com/VWDkv.png" alt="enter image description here"></p> <p>Or, you might want to think about plotting this as a heatmap using <a href="http://docs.ggplot2.org/current/geom_bin2d.html" rel="nofollow noreferrer"><code>geom_bin2d()</code></a>, and plotting facets (subplots) for each different <code>event_type</code>, like this:</p> <pre><code>p2 &lt;- ggplot(data = snb, aes(x = px, y = py)) + geom_bin2d(binwidth = c(0.25, 0.25)) + facet_wrap(~ event_type) print(p2) </code></pre> <p>which makes a plot for each level of the factor, where the color will be the number of data points in each bins that are 0.25 on each side. But, if you have more than about 5 or 6 levels, this might look pretty bad. From the small data sample you supplied, I got this</p> <p><img src="https://i.stack.imgur.com/ZDmLm.png" alt="enter image description here"></p> <p>If the levels of the factors don't matter, there are some nice examples <a href="https://stackoverflow.com/questions/7714677/r-scatterplot-with-too-many-points">here</a> of plots with too many points. You could also try looking at some of the examples on the <a href="http://docs.ggplot2.org/current/index.html" rel="nofollow noreferrer">ggplot website</a> or the <a href="http://www.cookbook-r.com/Graphs/" rel="nofollow noreferrer">R cookbook</a>. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload