Home > other >  Plot with circlize
Plot with circlize

Time:05-07

I work with library circlize and I made plot. Below you can see code

library(circlize)
random_values<-c(500:100)

random_sample<-sample(random_values,15)

col.pal = c(BMW = "red",
            Honda = "green",
            Nissan = "blue",
            Tesla = "grey",
            Toyota = "maroon",
            Phoenix = "grey",
            Tucson = "black",
            Sedona = "grey"
              )
Sample_Matrix <- matrix( 
                    random_sample,
                    nrow = 5,
          dimnames = list(c("BMW","Honda","Nissan","Tesla","Toyota"),
                          c("Phoenix","Tucson","Sedona")))

chordDiagram(Sample_Matrix,grid.col = col.pal)
                                                    

Now I want to use the title on this Title on this plot. Frequently I used ggplot2 and I have a title with the same font as ggplot2 to produce the plot. Can anybody help me how to this ?

CodePudding user response:

You can use this code to add a title:

chordDiagram(Sample_Matrix,grid.col = col.pal, annotationTrackHeight = c(0.03, 0.01), title(main = "title"))

Output:

enter image description here

  • Related