pooja sinha
2020-Feb-26 14:51 UTC
[R] Unable to resolve the issue of break point in ggplot2
Hi All, I have a data as shown below: TF YT_YC MT_MC AT_AC GRHL2 1e-2597 1e-2789 1.00E-281 Srebp1a 1e-1860 1e-1744 1e-944 EWS:ERG 1e-1831 1e-2127 1e-548 EWS:FLI1 1e-1580 1e-1937 1.00E-166 NFAT 1e-1418 1e-2224 1e-761 Sox4 1e-1410 1e-1839 1.00E-246 PU.1-IRF 1e-1361 1e-3661 1e-1380 Sox2 1e-1114 1e-1295 1e-399 Atoh1 1e-1108 1e-620 1e-590 EHF 1e-942 1e-1379 1e-1727 ETV1 1e-927 1e-1301 0.01 Nur77 1e-908 1e-795 1e-372 ZNF711 1e-814 1e-684 1e-576 Sox10 1e-769 1e-1115 1.00E-41 I am trying to make geom_tile in ggplot2 and I have the code below but after plotting I didn't find the gradient of colors after applying breaks. Can anyone suggest me how to apply breaks or other codes in ggplot2 so that I can have gradient of colors or other way of plotting. library(ggplot2) library(tidyr) library(dplyr) setwd("C:/Users/sinha.puja/Desktop/CP") mat_data1 <- read.csv(file="C:/Users/sinha.puja/Desktop/CP/TF_heatmap_plot.csv", sep=",") library(wesanderson) names(wes_palettes) pal <- wes_palette("Zissou1", 100, type = "continuous") mat_data1 %>% pivot_longer( cols = c("YT_YC", "MT_MC", "AT_AC"), names_to = "Age_group", values_to = "Value" ) %>% ggplot(aes(x = Age_group, y = TF)) + geom_tile(aes(fill=Value), width = 0.990, height = 0.900) + scale_fill_gradientn(colours = pal, limits =c(0.01, 1.e-3670)) Thanks in Advance. Puja [[alternative HTML version deleted]]
pooja sinha
2020-Feb-26 15:22 UTC
[R] Unable to resolve the issue of break point in ggplot2
Sorry I used limits in code and need to focus on both limits and breaks. On Wed, Feb 26, 2020 at 9:51 AM pooja sinha <pjsinha07 at gmail.com> wrote:> Hi All, > > I have a data as shown below: > TF YT_YC MT_MC AT_AC > GRHL2 1e-2597 1e-2789 1.00E-281 > Srebp1a 1e-1860 1e-1744 1e-944 > EWS:ERG 1e-1831 1e-2127 1e-548 > EWS:FLI1 1e-1580 1e-1937 1.00E-166 > NFAT 1e-1418 1e-2224 1e-761 > Sox4 1e-1410 1e-1839 1.00E-246 > PU.1-IRF 1e-1361 1e-3661 1e-1380 > Sox2 1e-1114 1e-1295 1e-399 > Atoh1 1e-1108 1e-620 1e-590 > EHF 1e-942 1e-1379 1e-1727 > ETV1 1e-927 1e-1301 0.01 > Nur77 1e-908 1e-795 1e-372 > ZNF711 1e-814 1e-684 1e-576 > Sox10 1e-769 1e-1115 1.00E-41 > I am trying to make geom_tile in ggplot2 and I have the code below but > after plotting I didn't find the gradient of colors after applying breaks. > Can anyone suggest me how to apply breaks or other codes in ggplot2 so that > I can have gradient of colors or other way of plotting. > > library(ggplot2) > library(tidyr) > library(dplyr) > setwd("C:/Users/sinha.puja/Desktop/CP") > mat_data1 <- > read.csv(file="C:/Users/sinha.puja/Desktop/CP/TF_heatmap_plot.csv", > sep=",") > library(wesanderson) > names(wes_palettes) > pal <- wes_palette("Zissou1", 100, type = "continuous") > mat_data1 %>% > pivot_longer( > cols = c("YT_YC", "MT_MC", "AT_AC"), > names_to = "Age_group", > values_to = "Value" > ) %>% > ggplot(aes(x = Age_group, y = TF)) + > geom_tile(aes(fill=Value), width = 0.990, height = 0.900) + > scale_fill_gradientn(colours = pal, limits =c(0.01, 1.e-3670)) > > Thanks in Advance. > Puja >[[alternative HTML version deleted]]