简体   繁体   中英

How can I show a dendrogram in the plot pane in R-Studio

I am producing a dendrogram using the following code:

#Hierarchial Clustering
hc<-hclust(distance_matrix,method='average')
plot(hc, cex=0.35, hang=-1)

在此处输入图像描述

The plot shows in the RMD window but not in the plot pane. How can I make it show-up in the plot pane?

I have tried updating RStudio.

I have tried running:

dev.off()

and

options(device = "RStudioGD")

None of these solutions worked. How can I show the dendrogram in the plot pane?

In general you can send chunk outputs to display inline or in the console. So at the top of the document you just add:

editor_options: 
  chunk_output_type: console

Then your plots (including your dendrogram) should appear in the viewer pane.

You can also toggle this option through the GUI in Rstudio by selecting the arrow next to the 'gear' icon at the top of the editor window and select 'Chunk Output in Console'. 在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM