I'm not quite sure that I understood what you want, but this is an attempt to solve [what I think] your problem:
Firstly, you have a very short vector, and the changes to freq very dramatic, so this will create a very βtileβ sense of plot. You must first address this issue. My approach uses spline interpolation:
newdf=data.frame(x=spline(df)[[1]],freq=spline(df)[[2]],y=rep(1,times=3*length(df$x)))
Note that I also created the vector y in the data frame.
Now it can be built using lattice levelplot :
levelplot(freq~x*y,data=newdf)
Which gives a smoother plot (as I understand it, this is what you need). It can also be applied using ggplot :
ggplot(newdf,aes(x=x,y=y,fill=freq))+geom_tile()
=========== EDIT ADD =============
Note that you can control the new vector length with the spline n argument, which makes for a smoother transition ( spline(df,n=100)[[1]] ). If you run this option, be sure to edit the times you repeat 1 in y definition !!. The default value of n is 3x the length of the input vector.
source share