ggExtra | Add marginal histograms to ggplot2 , and more ggplot2 | Data Visualization library

 by   daattali R Version: v0.8 License: Non-SPDX

kandi X-RAY | ggExtra Summary

kandi X-RAY | ggExtra Summary

ggExtra is a R library typically used in Analytics, Data Visualization applications. ggExtra has no bugs, it has no vulnerabilities and it has low support. However ggExtra has a Non-SPDX License. You can download it from GitHub.

📊 Add marginal histograms to ggplot2, and more ggplot2 enhancements
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              ggExtra has a low active ecosystem.
              It has 315 star(s) with 42 fork(s). There are 16 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 11 open issues and 99 have been closed. On average issues are closed in 64 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of ggExtra is v0.8

            kandi-Quality Quality

              ggExtra has 0 bugs and 0 code smells.

            kandi-Security Security

              ggExtra has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              ggExtra code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              ggExtra has a Non-SPDX License.
              Non-SPDX licenses can be open source with a non SPDX compliant license, or non open source licenses, and you need to review them closely before use.

            kandi-Reuse Reuse

              ggExtra releases are available to install and integrate.
              Installation instructions, 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 ggExtra
            Get all kandi verified functions for this library.

            ggExtra Key Features

            No Key Features are available at this moment for ggExtra.

            ggExtra Examples and Code Snippets

            No Code Snippets are available at this moment for ggExtra.

            Community Discussions

            QUESTION

            knitr::include_graphics() doesn't render figure with `bookdown`
            Asked 2022-Mar-28 at 17:25

            I'm trying to write up a report and simply want to include a .jpeg image in my write up. However, whenever i knit together my document, I get the following error:

            ...

            ANSWER

            Answered 2022-Mar-28 at 17:25

            I had the same issue and it seems you will need to pass the absolute path. See this .

            Instead of using here maybe try using normalizePath in include_graphics.

            So omit your call here(), which may not be propagating across chunks (I don't know, because I can't see your chunks), and do:

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

            QUESTION

            How can I load a package when I get this error?
            Asked 2022-Mar-15 at 10:10

            when i use

            ...

            ANSWER

            Answered 2022-Mar-15 at 10:10

            You could try remove and reinstall the packages with dependencies = TRUE by using this code:

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

            QUESTION

            Is it possible to have two different types of marginal distribution with ggExtra::ggMarginal()?
            Asked 2022-Mar-09 at 10:25

            Is it possible to have two different types of marginal distribution in ggMarginal()? E.g., density for x and histogram for y?

            ...

            ANSWER

            Answered 2022-Mar-09 at 10:25

            I think you need to create both plots and swap their upper margin grobs:

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

            QUESTION

            Patchwork doesn't recognize plots with ggMargnial distribution elements
            Asked 2022-Feb-13 at 18:24
            Trying to display 2 plots with ggMarginal but the plots are not recognized as such.

            I'm pasting a simplified version of the code below where:

            • Before adding the ggMarginal element Patchwork displays ggplots side by side as expected
            • After adding marginal distributions with ggMarginal, Patchwork doesn't seem to recognize the the plot any more. The error message that I get is the following:
            ...

            ANSWER

            Answered 2021-Oct-09 at 18:01

            Not sure whether there is an easy option to make patchwork work with objects of class ggMarginal.

            Another option to add side plots would be to make use of the ggside package which works fine with patchwork. One drawback of ggside is that (to the best of my knowledge) as of the moment it does not offer any options to style the side plots, i.e. it will inherit the style of the main plot's theme:

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

            QUESTION

            Align another object with scatterplot+marginal boxplots
            Asked 2022-Jan-20 at 13:48

            I've generated a scatterplot with marginal histograms on the x and y axes, using this extremely helpful answer from @ClausWilke (reproduced below).

            ...

            ANSWER

            Answered 2022-Jan-20 at 13:48

            You could:

            1. Change element_blank to axis.text.x = element_text(colour = "white") so axis text is the same colour as the plot background so not visible, forcing the axis label to be on the vertical position as the main plot.
            2. Include a dummy plot with NULL in the call to plot_grid
              And, in response to additional question in comments...
            3. use grid::nullGrob to make the right hand side plot panel the same height as the main plot panel.

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

            QUESTION

            R Annotate heatmap along x-axis (time interval)
            Asked 2021-Jul-26 at 05:33
            # load libraries
            library(ggplot2)
            library(viridis)
            library(lubridate)
            library(ggExtra)
            library(tidyverse)
            
            # read 
            checkin_malaysia_time <- read_csv(file = 'https://raw.githubusercontent.com/MoH-Malaysia/covid19-public/main/mysejahtera/checkin_malaysia_time.csv')
            
            # pivot longer for ggplot
            checkin_malaysia_time <- checkin_malaysia_time %>%
             pivot_longer(!date, names_to = "hour", values_to = "count")
            checkin_malaysia_time
            
            # date feats
            checkin_malaysia_time <- checkin_malaysia_time %>% 
             dplyr::mutate(day = lubridate::day(date),
                           month = lubridate::month(date),
                           year = lubridate::year(date),
                           ith_hour = as.integer(hour),
                           yearmon = as.factor(zoo::as.yearmon(date))) %>% 
             dplyr::select(yearmon, day, ith_hour, month, year, count)
            # map hour
            checkin_malaysia_time$hour <- rep(rep(0:23,each = 2),237)
            
            # hourly data
            checkin_malaysia_time_hour <- checkin_malaysia_time %>%
             group_by(yearmon, day, month, year, hour) %>% 
             summarise(count = sum(count)) %>% ungroup()
            
            # plot
            p <-ggplot(checkin_malaysia_time_hour,
                       aes(day,hour,fill=count))+
             geom_tile(color= "white",size=0.1) + coord_equal() + 
             scale_fill_viridis(name="Hourly checkins",option ="H")
            p <-p + facet_wrap(year~month, nrow = 1)
            p <-p + scale_y_continuous(trans = "reverse", breaks = seq(0,23,2))
            p <-p + scale_x_continuous(breaks =sort(c(1,seq(5,25,5),31)))
            p <-p + theme_minimal(base_size = 8)
            p <-p + labs(title= paste("Checkin Time Density",' - MySejahtera'), x="Day", y="Hour")
            p <-p + theme(legend.position = "right") +
             theme(plot.title=element_text(size = 14))+
             theme(axis.text.y=element_text(size=6)) +
             theme(strip.background = element_rect(colour="white"))+
             theme(plot.title=element_text(hjust=0))+
             theme(axis.ticks=element_blank())+
             theme(axis.text=element_text(size=7))+
             theme(legend.title=element_text(size=8))+
             theme(legend.text=element_text(size=6))+ 
             removeGrid()
            p
            
            
            
            ...

            ANSWER

            Answered 2021-Jul-26 at 05:33

            You could draw in the lines "manually" with grid, e.g.

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

            QUESTION

            How do I order my months (Jan through Dec) in this plot in R? Transforming months to factor gives me thousands of NA
            Asked 2021-Jun-17 at 20:47

            I feel like I've tried about everything...If I transform the months into factors, I get 16 thousand NA's. As my code is I get the plot to come out, but with the months out of order.

            I got the original code here: https://www.r-graph-gallery.com/283-the-hourly-heatmap.html

            I've edited it to fit my data, but my months come out out of order.

            My months are numbers in the csv file (int in r), then changing them to abbreviations makes them characters.

            ...

            ANSWER

            Answered 2021-Jun-17 at 20:47

            You should have constructed MonthAbb as a factor. That way you could have specified the ordering of the levels attribute which most plotting functions will honor when it comes time for plotting.

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

            QUESTION

            How can I adjust the size of two ggplots with a fixed aspect ratio in gridExtra?
            Asked 2021-Mar-23 at 04:42

            I am trying to present a graph plotting the results of three regression equations using ggplot and gridArrange. However, I have noticed a problem when trying to plot the residuals of these regressions. I am trying to plot these graphs on a fixed coordinate system with an aspect ratio of 1, given they are both residuals of a dataset are proportional residuals relative to the original measurement. However, when I print the combined graph in ggExtra I end up with one graph being much shorter than the other and the titles of the graphs are not aligned.

            I know this is due to the fact that both graphs are set to different width because of the coord_fixed call. However, I do not know how to adjust this in the final graph so both graphs are the same size. What I want to do is increase the white space of the smaller graph to make the two the same dimensions but keep the fixed 1:1: aspect ratio the same. I have found that including the respect=TRUE does not work to fix this.

            Below is code that reproduces my example.

            ...

            ANSWER

            Answered 2021-Mar-23 at 04:42

            EDIT after clarification: We can use ylim(-150, 200) in plot1

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

            QUESTION

            Scaling plots to get same size on same row
            Asked 2020-Oct-11 at 10:07

            I'm trying to reproduce this figure, I'm facing hard times in reproducing two things, the right scale ratio (all plots are square with clear top title and top left corner letter label), the second is I see a gap between the marginal graphs and the plots themselves. What I want to achieve is this:

            My dataset:

            ...

            ANSWER

            Answered 2020-Oct-11 at 10:07

            In order to make the plot square use:

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

            QUESTION

            Fixing elongated figures next to each other in R
            Asked 2020-Oct-09 at 07:23

            I'm trying to replicate the theme of these graph using ggplot, I searched online for articles and question to show me how to assign these plots the right size and position and also to assign the tight dot shape, and I found few articles that discussed changing position, I tried the following:

            ...

            ANSWER

            Answered 2020-Oct-09 at 07:23

            Maybe this fits your need. To glue the three plots together I make use of the cowplot package. The legend is probably still not perfect.

            1. To get only one legend but still a nice alignment of the plots I made the legends for the first and the third plot "transparent" vis guide_legend and theme options

            2. To make all plots the same size I added transparent marginals to the scatter plot

            3. To fix the position and make the plots square I set the same limits for both axes via xlim and ylim and set the aspect ratio to 1 using theme()

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

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

            Vulnerabilities

            No vulnerabilities reported

            Install ggExtra

            ggExtra is available through both CRAN and 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

            Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link