首页 > 解决方案 > 如何使用 plot_ly 在 R 中的等高线上赋值

问题描述

我在 R Studio 中使用plot_ly来绘制等高线图。我希望等高线直接在图表上显示它们的值(类似于此处的图像:http ://www.cyber-wit.com/onlineHelp/Images/contour.png )。我不知道如何实现这一点。这是我的代码:

plot_ly(width = 600, height = 600,
      type = 'contour',
      z=Matrix_Contour,
)

谢谢您的帮助!

标签: rplotlycontour

解决方案


为此,您需要showlabels = TRUE

plot_ly(z = volcano, type = "contour", contours = list(showlabels = TRUE))

在此处输入图像描述


推荐阅读