How can I avoid white space in my levelplot in R

411 views Asked by At

I have a data frame with 3 columns and plotted the levelplot accordingly. However, my output figure (a pdf) is too heavy and I need to reduce the size of it. Using bash, I removed one line out of ten (at /Users/datac.csv | awk ' { if (NR %10 == 0) { print $0 } } ' > /Users/new_file.csv) and ended up with the level plot with a lot of white space (as expected). Any idea how to increase the size of my points? I don't mind if they look like a raster. Here is my code (data frame in here) and plot here:

        datac=read.csv("new_file.csv",header=FALSE) #import from csv
        x<-datac[[1]]
        y<-datac[[2]]
        sol<-datac[[3]]
        color1= colorRampPalette(c(gray(0.3),'gray','white'))
        levelplot(sol~x*y,asp=1,colorkey = FALSE,col.regions=color1)

I have also explored the option to directly obtain the line from the level plot and then fill with color (loop for when sol (or z) changes values and use panel.spline and predict(r)) but it is very specific to each situation and I'd be happier with a general solution ! Thanks!

0

There are 0 answers