Removing the center white circle?

I have a circular plot, and I would like to find a way to remove the small white circle in the middle.

Here is my code:

ggplot(d5)+geom_tile(aes(x=x, y=y, fill=xyz))+
   scale_y_continuous(expand=c(0,0),breaks=NULL,limits=c(0,3.6))+
   scale_fill_continuous(low="darkgreen", high="white")+
   coord_polar(start=-1*pi/2, direction=1)+
   theme_bw()+
   theme(panel.grid.major = element_blank(),panel.grid.minor = element_blank())

many thanks.

+4
source share
2 answers

I made a dummy example here:

require(dplyr)
expand.grid(x = 1:20, y = 1:2) %>% 
  mutate(z = rnorm(length(x))) %>% 
  ggplot()+geom_tile(aes(x=x, y=y, fill=z))+
  scale_y_continuous(expand=c(0,0),breaks=NULL,limits=c(0,3.6))+
  scale_fill_continuous(low="darkgreen", high="white")+
  coord_polar(start=-1*pi/2, direction=1)+
  theme_bw()+
  theme(panel.grid.major = element_blank(),panel.grid.minor = element_blank())

enter image description here

You are on the right track with arguments limitsand expand scale_yyou just need to find out where the actual lower bound is. To do this, let me build the same set without coord_polarand without yours scale_y.

enter image description here

, y=0.5. , y, height geom_tile ( 1). y, .

enter image description here

+2

, @Brian.
y, , :

library(dplyr)
library(ggplot2)
set.seed(4321)
d5 <- expand.grid(x = 1:20, y = 1:2) %>% 
  mutate(z = rnorm(length(x))) 

yval <- sort(unique(d5$y))
h <- (yval[2] - yval[1])/2
ylim_lo <- yval[1] - h
ylim_up <- yval[2] + h

ggplot(d5)+geom_tile(aes(x=x, y=y, fill=z))+
   scale_y_continuous(expand=c(0,0), breaks=NULL, limits=c(ylim_lo,ylim_up)) +
   scale_fill_continuous(low="darkgreen", high="white") +
   coord_polar(start=-1*pi/2, direction=1) +
   theme_bw()+
   theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())

enter image description here

+1

Source: https://habr.com/ru/post/1679472/


All Articles