Skip to content

Have ggplotly() replace default fonts with thematic's font option #1804

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 26, 2020

Conversation

cpsievert
Copy link
Collaborator

@cpsievert cpsievert commented Jun 26, 2020

Closes #1803, here's an example:

library(shiny)
library(plotly)
library(thematic)

thematic_shiny(font = "auto")

ui <- fluidPage(
  titlePanel("Hello auto theming with ggplotly()"),
  tags$head(
    tags$link(href="https://fonts.googleapis.com/css?family=Pacifico", rel="stylesheet"),
    tags$style(HTML("body{background-color:#444444; color:#e4e4e4; font-family: Pacifico}")),
    tags$style(HTML("a{color:#e39777}"))
  ),
  plotlyOutput("p")
)

server <- function(input, output, session) {
  output$p <- renderPlotly({
    p <- ggplot(faithfuld, aes(waiting, eruptions, z = density)) + 
      geom_raster(aes(fill = density)) + 
      geom_contour()
    ggplotly(p)
  })
}

shinyApp(ui, server)

Screen Shot 2020-06-26 at 12 24 16 PM

@cpsievert cpsievert requested a review from schloerke June 26, 2020 17:25
@cpsievert cpsievert merged commit 1d1eddd into master Jun 26, 2020
@cpsievert cpsievert deleted the thematic-fonts branch June 26, 2020 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better integration with thematic fonts
2 participants