mattflor / chorddiag

R interface to D3 chord diagrams
158 stars 44 forks source link

Rotate Labels #2

Open mviertel opened 8 years ago

mviertel commented 8 years ago

Hi! Short question regarding group labels: is it possible to rotate them?

See: http://stackoverflow.com/questions/31943102/rotate-labels-in-a-chorddiagram-r-circlize

Awesome work, by the way!!!

Best

mattflor commented 8 years ago

What you mean? Group labels are rotated already perpendicular to the group arcs, just like in the SO question.

mviertel commented 8 years ago

I was just wondering whether I have control over the rotation. I´d like to have them horizontal to the arcs like in the left graph.

mattflor commented 8 years ago

I see. I'm sorry that's not possible at the moment.

mviertel commented 8 years ago

Thanks for the info!

I have one more and final question: Have you experienced that the tooltips seem to be getting misplaced in shiny apps if you need to scroll down to reach the plot. I added a minimal example and a screenshot.

Any Ideas?

ui.r:

require(shiny)
require(shinydashboard)
require(shinythemes)
require(chorddiag)

if (interactive()) {
  header <- dashboardHeader()

  sidebar <- dashboardSidebar(
    sidebarMenu(
      # Setting id makes input$tabs give the tabName of currently-selected tab
      id = "tabs",
      menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard"))
    )
  )
  body <- dashboardBody(
    tabItems(
      tabItem("dashboard",
              div(p("Dashboard tab content"),
                  fluidRow(
                    box(height = "600px",
                        "bla")
                  ),
                  fluidRow(
                    column(3,
                           sliderInput("margin", "Margin",  min = 0, max = 200, value = 100),
                           sliderInput("groupnamePadding", "Group Name Padding",  min = 0, max = 100, value = 30),
                           checkboxInput("showTicks", "Show Ticks", value = TRUE)
                    ),
                    box(
                      title = "Plot",
                      chorddiagOutput('chorddiag', height = '600px')
                    )
                  ))
      )
    )
  )
dashboardPage(header, sidebar, body)
}

Server.r:

require(shiny)
require(shinydashboard)
require(shinythemes)
require(chorddiag)

m <- matrix(c(11975,  5871, 8916, 2868,
              1951, 10048, 2060, 6171,
              8010, 16145, 8090, 8045,
              1013,   990,  940, 6907),
            byrow = TRUE,
            nrow = 4, ncol = 4)
groupNames <- c("black", "blonde", "brown", "red")
groupColors <- c("#000000", "#FFDD89", "#957244", "#F26223")

row.names(m) <- groupNames
colnames(m) <- groupNames

server<-function(input, output) {
  output$chorddiag <- renderChorddiag(
    chorddiag(m
              #groupColors = groupColors,
              #groupnamePadding = input$groupnamePadding,
              #showTicks = input$showTicks,
              #margin = input$margin
    )
  )
}

image

mattflor commented 8 years ago

I just commited a fix for the placement issue, so just install the latest version. Let me know if it works for you.

mviertel commented 8 years ago

Works like a charm!! Thanks a lot!

YubinXie commented 5 years ago

I am also hoping to be able to make the label to be horizontal; it is really hard to read perpendicular text. (Thanks for your great package!)

Mohsin0911 commented 5 years ago

Hi! please guide me same question like its possible to rotate group labels: and ##how to save as 3d form ## this is my script `library(chorddiag)

data<- read.csv("C:/Users/Hp/Desktop/final chord diagram 16 s.csv", sep=",", header = T, row=1)

my.data <-as.matrix(data)

row.names(my.data) <- c("HL", "HR", "ML", "MR", "LL", "LR", "RL", "RR")

colnames(my.data) <- c("Alphaproteobacteria", "Betaproteobacteria", "Gammaproteobacteria", "Actinobacteria", "Firmicutes", "Bacteroidetes", "Others")

groupColors <- c("orange", "maroon","cyan", "salmon","sienna1", "skyblue", "gold", "pink","chocolate", "red", "grey", "green","brown", "blue", "purple")

chorddiag(my.data,type = "bipartite", showTicks = T,tickInterval = 5 ,groupColors = groupColors , groupnameFontsize = 15,grop_ ,groupnamePadding = 20, margin = 100 Rplot05 ) ` thanks in advance

pedro-longhin commented 4 years ago

I see. I'm sorry that's not possible at the moment.

is this option still not available? i want to rotate the labels, but they are automatic going to perpendicular position.