簡體   English   中英

如何在 Filled.contour 中設置 plot 軸?

[英]How to plot axes in Filled.contour?

我使用填充輪廓將矩陣轉換為具有顏色漸變的圖像。 在此處輸入圖像描述 我的軸名稱顯示在 plot 上,但不顯示比例和值。 The plot.axes function does not return any error but doesn't add anything to my plot so I guess there is an issue with that (my x-axis ranges from 350 to 500 and my y from 200 to 450 based on my matrix)這是我使用的代碼:

filled.contour(matrix, 
               color.palette = colorRampPalette(c("blue", "green",
                                          "yellow","orange","red")), 
               main = "Spectre 3D Puyricard",  
               xlab = "émission",
               ylab = "excitation", 
               plot.axes={ axis(1, seq(350, 500, by = 10)) 
               axis(2, seq(200, 450, by = 10)) })

它有什么問題?

謝謝

您沒有指定xy arguments,因此它們將從 0 運行到 1。您要求的軸不會出現在該范圍內。 所以你應該做的是設置

x <- seq(350, 500, length=nrow(matrix))
y <- seq(200, 450, length=ncol(matrix))

然后在對 plot 的調用中給出兩者:

filled.contour(x, y, matrix, 
               color.palette = colorRampPalette(c("blue", "green",
                                          "yellow","orange","red")), 
               main = "Spectre 3D Puyricard",  
               xlab = "émission",
               ylab = "excitation")

我省略了plot.axes參數,因為默認值可能已經足夠好了,但是如果您不喜歡選擇刻度線或其他內容,可以將其添加回來。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM