2

Unfortunately, at this point there is no functionality in d3heatmap to change the color of the axis labels. This limits one's ability to style the plots using a nifty 'css' style, as you can see below:

enter image description here

There must be a way to manipulate the javascript code; see previous stackoverflow.com question for an easy way to find these files on your local machine.

Here is a reproducible example (although my specific problem is within a {shiny} app):

library(d3heatmap)

d3heatmap(x = mtcars,
      Colv = NULL,
      scale= "column",
      key = FALSE,
      yaxis_font_size = "0pt",
      xaxis_font_size = "10pt")
Community
  • 1
  • 1
Dr. Daniel
  • 73
  • 5
  • 1
    Please include a reproducible example. See here for guidelines: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Jason Oct 14 '16 at 01:05
  • This should be doable with CSS, but please provide a reproducible example (code). – Xiongbing Jin Oct 14 '16 at 01:22

1 Answers1

2

Just add this somewhere in your ui.R. Change the color as needed.

    tags$head(tags$style(HTML("
                              svg.xaxis text {
                                fill: #0000ff;
                              }
                              ")))

Complete example

library(shiny)
library(d3heatmap)

ui <- shinyUI(fluidPage(

   titlePanel("Old Faithful Geyser Data"),

   sidebarLayout(
      sidebarPanel(
        tags$head(tags$style(HTML("
                                  svg.xaxis text {
                                    fill: #0000ff;
                                  }
                                  ")))
      ),

      mainPanel(
         d3heatmapOutput("out")
      )
   )
))

server <- shinyServer(function(input, output) {

  output$out <- renderD3heatmap({
    d3heatmap(x = mtcars,
              Colv = NULL,
              scale= "column",
              key = FALSE,
              yaxis_font_size = "0pt",
              xaxis_font_size = "10pt")
  })

})

shinyApp(ui = ui, server = server)
Xiongbing Jin
  • 11,779
  • 3
  • 47
  • 41