Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
I'm trying to create a contour plot in R from 3 vectors.
I have:
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)
And I want to plot something like that (made in SigmaPlot)
How can I do it in R?
您可以使用plotly包:
plotly
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')
这会给你:
> p