Git Product home page Git Product logo

Comments (5)

jbkunst avatar jbkunst commented on May 24, 2024

Hi!

Can you give me an example to replicate in my pc and start to debugging?

Probably is an issue with the d3 version.

from d3wordcloud.

sherrylau avatar sherrylau commented on May 24, 2024

Sure,

For the app below, it only shows the simpleNetworkOutput graph but not the wordcloud. If i comment out that line, i can see the output for wordcloud.

app = shinyApp(
  ui = bootstrapPage(
    p("Word Cloud"),
    d3wordcloudOutput("wordCloud"),
    simpleNetworkOutput("networkGraph")
    ),
  server = function(input,output,session){
    library(tm)
    data("acq")
    corpus = acq
    dtm = DocumentTermMatrix(corpus)

    output$wordCloud = renderD3wordcloud({
      dtm = as.matrix(dtm)
      freq = colSums(dtm)
      freq = sort(freq, decreasing=TRUE)
      freqDF = data.frame(Word=rownames(data.frame(freq)),Frequency=freq)
      freqDF = freqDF[freqDF$Frequency>=10,]
      d3wordcloud(freqDF$Word, freqDF$Frequency)
    })

    networkGraphPreprocess = reactive({
      dtm_mtx = t(as.matrix(dtm))
      dtm_mtx[dtm_mtx>=1] = 1
      termMatrix = dtm_mtx %*% t(dtm_mtx)
      g = graph.adjacency(termMatrix, weighted=T, mode="undirected")
      g = simplify(g, remove.multiple=TRUE, remove.loops=TRUE)
      V(g)$label = V(g)$name
      V(g)$degree = degree(g)
      g2 = induced.subgraph(g, E(g)[neighbors(g,"withdrawal")])
      g2
    })

    output$networkGraph = renderSimpleNetwork({
      g2 = networkGraphPreprocess()
      g2 = get.data.frame(g2)
      colnames(g2) = c("Source","Target","Weight")
      simpleNetwork(g2, 
                    width=550, 
                    height=550,
                    fontSize = 10,
                    textColour = "#4f372d",
                    linkColour = "#4f372d",
                    nodeColour = "#cc2a36",
                    nodeClickColour = "#00a0b0",
                    opacity=0.8)
    })

  }
)
runApp(app)

from d3wordcloud.

jbkunst avatar jbkunst commented on May 24, 2024

Hi @sherrylau,

Please, download again and tell me if now your example works.

Aps, the next time please provide all the requiriments ;)

library("shiny")
library("networkD3")
library("d3wordcloud")
library("igraph")

it is easier / faster to reproduce the examples.

from d3wordcloud.

sherrylau avatar sherrylau commented on May 24, 2024

It works perfectly! Thanks for your help!

Sherry

from d3wordcloud.

jbkunst avatar jbkunst commented on May 24, 2024

Thank you for notice this error!

from d3wordcloud.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.