Have you tried to write code for this? If so, you should post it, and show where you are stuck. The package ggplot2 and geom_contour() would be a starting point: e.g., ggplot(df, aes(x = x, y = y, z = z)) + geom_contour() From there, you would change the fill, add a legend and labeling.
- ssp3nc3r
Or you could look at the base graphics function contour
- G5W
1 Answers
6
votes
You can use plotly package:
x=c(1,1,1,2,2,2,3,3,3)
y=c(0,10,20,0,10,20,0,10,20)
z=c(900,800,700,600,500,400,300,200,100)
df <- data.frame(x=x,y=y,z=z)
library(plotly)
p <- plot_ly(data = df, x=~x,y=~y, z=~z, type = "contour", colorscale='Jet')
This will give you:
> p
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.OkRead more
ggplot2andgeom_contour()would be a starting point: e.g.,ggplot(df, aes(x = x, y = y, z = z)) + geom_contour()From there, you would change the fill, add a legend and labeling. - ssp3nc3rcontour- G5W