ggdendro | Tools to extract dendrogram plot data for use with 'ggplot2 | Data Visualization library

 by   andrie R Version: 0.1.20 License: No License

kandi X-RAY | ggdendro Summary

kandi X-RAY | ggdendro Summary

ggdendro is a R library typically used in Analytics, Data Visualization applications. ggdendro has no bugs, it has no vulnerabilities and it has low support. You can download it from GitHub.

Provides functions for creating dendrograms and tree plots using ggplot2.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              ggdendro has a low active ecosystem.
              It has 72 star(s) with 10 fork(s). There are 10 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 5 open issues and 23 have been closed. On average issues are closed in 162 days. There are 1 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of ggdendro is 0.1.20

            kandi-Quality Quality

              ggdendro has no bugs reported.

            kandi-Security Security

              ggdendro has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              ggdendro does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              ggdendro releases are available to install and integrate.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ggdendro
            Get all kandi verified functions for this library.

            ggdendro Key Features

            No Key Features are available at this moment for ggdendro.

            ggdendro Examples and Code Snippets

            No Code Snippets are available at this moment for ggdendro.

            Community Discussions

            QUESTION

            Rshiny data classification and summary statistics errors
            Asked 2020-Dec-23 at 13:44

            I'm new to Rshiny. I have been tasked with the following:

            Write a shiny app which uses a Navbar, with headings "Data Exploration" and "Classification tools", so that, within the Data Exploration tab, the user can:

            1. choose any variable and see summary statistics of it,

            2. use a select input to see summary statistics of a variable by Rate category.

            3. see a plot of the beertax variable by Rate group when the app is first opened.

            4. Choose any variable and visualise its relationship with the Rate variable. Different plots should appear depending on whether the selected variable is continuous or categorical.

            within the Classification tools tab, the user can:

            1. use a slider input to select from (0.4, 0.5, 0.6, 0.7, 0.8), the proportion of data used for the training data set (we will not be using the test data here, so you should use the complement proportion for the validation data set.)

            2. view a classification tree for the training data, and use the radio buttons to either "view pruned tree" or "view unpruned tree". Where, for the pruned tree, pruning should be done using the cp value that corresponds with the smallest xerror.

            3. see both the correct- and miss- classification rates (using the validation data) for the pruned classification tree and one of LDA or QDA, these results should be presented in a table. The "best" classification method, i.e. that with the lowest missclassification rate, should be highlighted and there should be a note to inform the user of what the highlighting means.

            4. make a prediction of the Rate status (i.e. above or below the US average) of an average unseen state, using the "best" classification method, with a user defined set of observed variable values (i.e. input options will be needed to allow the user to input their desired observed values). The default user defined values, that appear when the app is opened, should be the mean of the continuous variables and the mode of the categorical variables. There should also be a warning which alerts the user when they are extrapolating.

            Currently, I've pretty much completed up to step 3 of the Classification tools tab. However, I'm experiencing various errors that I need help with. I'll talk about them in order:

            1. When I run the app after opening Rstudio, my first tab 'Data Exploration' runs fine. However, whenever I reload the app, the summary table fails and I get the error 'unused argument (input$variable)'. I'm not sure why this is happening.

            2. When I run the app, there appears an error on the second tab 'Classification tools' which reads 'non-numeric argument to binary operator'. I investigated what this meant and I think I understand it but i'm just not sure how this error applies to my code. Instead of this error, my aim is to generate a table which includes the classification rate and missclassification rate of the CART model and eventually the LDA model too (dependent on the training data proportion input).

            3. Following from issue 2, I investigated my code and realised that I think the previous error occurs due to the line lda.pred <- predict(lda.model, newdata = valid.data[,-6]) and so I removed the code to see what would happen and then I end up with a new error 'unused argument (pred == valid.label)'. Again, I don't understand why this is happening.

            Here is my code:

            ...

            ANSWER

            Answered 2020-Dec-23 at 13:44

            The use of req() and as.numeric() should fix the first two issues. You should be able to fix the last one after this.

            EDIT

            Changing select(input$variable) to dplyr::select(input$variable) should eliminate your first error. There are 4 other packages with the same function select(), in your list of packages; hence you need to specify which package you intend to use it from or load dplyr last.

            Source https://stackoverflow.com/questions/65384403

            QUESTION

            How do I plot dendrogram leaves by a given value (depth in a sediment core) rather than in sequential order?
            Asked 2020-Dec-08 at 22:44

            I am working with ecological data (the percentage abundance of different diatom species present at different depths in a sediment core) and want to plot the results alongside a dendrogram representing the results of a hierarchical cluster analysis (CONISS) that I will use to split the core into ecological zones.

            This is an example of the type of thing I am trying to achieve:

            I have successfully run the cluster analysis but am struggling to plot the dendrogram the way I would like to. Whenever I plot the dendrogram, it plots the leaves of the dendrogram in sequential order (as shown here). However, I need the leaves to plot by depth from the top of the sediment core so that there is a leaf present at each depth of the core that I have examined and so that there are gaps in the dendrogram where I have missing samples (as shown here). (Note there is no y-axis shown here as the dendrogram will join onto the rest of the diagram, which already contains the y-axis.)

            I managed to create the latter plot through the rioja package using plot.chclust and providing the depths for the leaves to the xvar argument. However, I have constructed the rest of my diagram (the species abundance data, PCA results etc.) with ggplot (and the help of the tidypaleo package) and then combined the various aspects of it using cowplot. I need to be able to create the dendrogram through ggplot in order to add it to my main diagram. I have investigated both the ggdendro and dendextend packages but can't find a way to plot the dendrogram according to depth using these. Is this possible? Do these packages have a function to do this that I am not aware of? I started looking into the source code for these packages as well as for as.dendrogram to see if I could figure out a way of modifying the functions to plot the leaves by depth but it is beyond my skill level. I was wondering if anyone has a solution to enable me to plot my dendrogram by depth in my sediment core rather than in sequential order?

            My data

            This is the data that I have used to calculate the distance matrix in the code below. (Apologies for the very long dput!)

            My code to plot the dendrograms ...

            ANSWER

            Answered 2020-Dec-08 at 21:43

            The actual depths are mapped to the x values in ddata$labels, so you can reverse-map the x values to actual depths. A handy way to do this is with approxfun:

            Source https://stackoverflow.com/questions/65207033

            QUESTION

            R Shiny, zoomable dendrogram program
            Asked 2020-Aug-08 at 16:31

            I have a massive dendrogram with hundreds of names on it, that I'd like to be make interactive so that users can draw a box and "zoom in" on the names and part of the tree of interest. The original code for creating it is borrowed from here. Pictured here:

            I turned it into a shiny app and borrowed some code from here in order to make it zoomable. And it KINDA works. It runs, the two graphs show up, and nothing gives me an error. But it doesn't work as intended. (I'll post code below). What I mean is that if I were to simply render my plot outside of shiny, all the names and everything are included. But when it renders in shiny, I can't draw my box over the names, only the lines of the dendrogram (hope that makes sense), and the "zoomed" graph is turned sideways (something to do with the coord_cartesian? What would I use instead) and looks very weird when it "zooms". Lastly I can't see both graphs at the same time and have to use a scroll bar to get to them, pictured:

            Help! Code below (its from an r markdown document if that matters, sorry I couldn't include the actual data, has real names.

            ...

            ANSWER

            Answered 2020-Aug-08 at 16:31

            The tool I'd suggest using is dendextend+ggplot+plotly.

            Example:

            Source https://stackoverflow.com/questions/63286645

            QUESTION

            Right align horizontal y axis titles for multiple plots using R ggplot2
            Asked 2020-Aug-06 at 13:40

            I'm having trouble right aligning horizontal y axis titles for multiple plots in R ggplot2. I have a main plot which is a dendrogram with leaf labels created using the ggdendro package, and I have multiple color bars below the main plot with titles to the left. If I use grid.arrange to place the plots on the same page, I'm able to get good vertical spacing between the plots, but I'm not able to right-align the y axis titles for the color bars consistently. If I use plot_grid, I can right-align the y axis titles consistently, but I'm having trouble getting appropriate vertical spacing between plots. Any help would be appreciated!

            Update: Two suggested solutions work equally well so I'm accepting the first one as the answer. Using ggarrange from the egg package and using plot_grid with align = "v" instead of align = "hv" both fixed my problem.

            Create main plot and color bars:

            ...

            ANSWER

            Answered 2020-Aug-06 at 08:56

            egg package will get the job done

            Source https://stackoverflow.com/questions/63277439

            QUESTION

            Color labels of ggdendro plot
            Asked 2019-Feb-11 at 09:21

            I am trying to apply dendextend in order to color the ggdendro labels. I get this error:

            ...

            ANSWER

            Answered 2019-Feb-11 at 08:46

            Seems you were confusing dendrogram with dendrogram data. This will work:

            Source https://stackoverflow.com/questions/54616539

            QUESTION

            ggdendrogram labels
            Asked 2019-Feb-11 at 08:21

            How can I change the labels of the dendrogram to them matching name in the list? At the moment I only get the list number.

            Code:

            ...

            ANSWER

            Answered 2019-Feb-08 at 13:50

            You are loosing your labels right after dtw_distmat function:

            Source https://stackoverflow.com/questions/54593085

            QUESTION

            how to extend the length of leaf node in dendrogram and add node labels
            Asked 2018-Apr-26 at 02:48

            My task is to create a dendrogram, but the leaf nodes shows blunt edges. How would I extend the length of the leaf node, and add node labels?

            Please see the current and expected images below.

            Data:

            ...

            ANSWER

            Answered 2018-Apr-26 at 02:48

            There are a couple of ways to do this, the simplest is probably to apply a function recursively over the nodes of the dendrogram using dendrapply.

            If you insert a new line to assign the dendrogram object:

            Source https://stackoverflow.com/questions/50030324

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install ggdendro

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/andrie/ggdendro.git

          • CLI

            gh repo clone andrie/ggdendro

          • sshUrl

            git@github.com:andrie/ggdendro.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link