Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Plotting too many points?

Tags:

plot

r

large-data

How does R (base, lattice or whatever) create a graph from a 100000 elements vector (or a function that outputs that values)? Does it plot some and reject others? plot all on top of each other? How can I change this behaviour?

How could I crate a graph where for every interval I see the max and min values, as in the trading "bar" charts? (or any other idea to visualize that much info without needing to previously calculate intervals, mins and maxs myself nor using financial pakages)

How could I create a large "horizontally scrolleable" plot?

For example I want to plot the first 100000 iterations

zz <- (zz^2+1) %% nn     

starting at zz=1, nn = 10^7+1 The x axis would be just the iteration number.

Summarizing. I want to plot a the output of a function that is sometimes soft but sometimes very spiky, over a very large interval. That spikes are very important.

regards

like image 273
skan Avatar asked Apr 09 '26 02:04

skan


1 Answers

You mention tha tyou sometimes have spikes which are vey important.

See below how I plot ping results, where the vast majority of data is in the milliseconds, but the spikes are important for me as well:

ping

Basically, I hexbin all data points with response time < 500 ms, and plot points for all longer response times. 5s response time is additionally marked as timeout:

ggplot (df, aes (x = date, y = t5)) + 
        stat_binhex (data = df [df$t5 <= 0.5,], bins = nrow (df) / 250) +
        geom_point (data = df [df$t5 > 0.5,], aes (col = type), shape = 3) +
        ylim (c (0, 5)) +
        scale_fill_gradient (low = "#AAAAFF", high = "#000080") +
        scale_colour_manual ("response type", 
                             values = c (normal = "black", timeout = "red")) + 
        ylab ("t / s") 

I think I already posted this as a solution to a similar question, but I couldn't find it.

like image 188
cbeleites unhappy with SX Avatar answered Apr 11 '26 18:04

cbeleites unhappy with SX



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!