Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!
Is it possible to create an R-Visual with a transparent background i.e. so that you can see an image added to the page background behing the plot the R-Visual generates?
Specifically I'm using ggplot2 and setting the fill of both plot.background andpanel.background to "transparent", but there still seems to be a white background between this and the background I can control through the PBI format options.
Solved! Go to Solution.
I don't know whether this will work with ggplot2 but in a visual I made based on the fmsb package I was able to work around this issue by using the par() function before the plotting was called:
# generic par function for graphical elements, call before the plotting
par(bg="transparent")
# this is wear the plotting of the visual actually happens radarchart(data)
I don't know whether this will work with ggplot2 but in a visual I made based on the fmsb package I was able to work around this issue by using the par() function before the plotting was called:
# generic par function for graphical elements, call before the plotting
par(bg="transparent")
# this is wear the plotting of the visual actually happens radarchart(data)
I know this is an old thread but set the fill and the color of the element_rect layer equal to the background color
Hi @jfallt , the problem is that the page background is an image. I've not tested in a while, but have you been able to set the fill to transparent?
Hi
Do you solve the problem?
I have the same issue,too.
If you have already solved the problem, could you send me the method by email, cy-song@163.com ,please.
Thank you so much
I'm sorry
just try again
Were you able to figure this out?
Hi,
Could you figure this out?
No, I never found a solution for this
Is there a way this can be reported to Microsoft, because this really makes my visual not usable?
No, sorry. I never resolved this
Hi
Do you solve the problem?
I have the same issue,too.
If you have already solved the problem, could you send me the method by email, cy-song@163.com ,please.
Thank you so much
I'm sorry
just try again
Hi
Do you solve the problem?
I have the same issue,too.
If you have already solved the problem, could you send me the method by email, cy-song@163.com ,please.
Thank you so much
There is no option in Format pane to make the R visual background to be transparent. Only small part (around the R visual) can be transparent as below.
But we should be able to set bg="transparent" to make it to be transparent like below. Could you please share your R scripts written in the R script editor? Please also take a look at this link to see if it helps.
Best Regards,
Herbert
Thanks Herbert. This is the final part of my script:
g <- g + theme_void() + theme( axis.text.x = element_text(angle = 45,size=11,vjust=0.9), legend.position="none", plot.background = element_rect(fill="transparent", color=NA), panel.background = element_rect(fill="transparent", color=NA) ) par(bg="transparent") g
But as you can see I still have a white background:
How about the result if update the script as below? If problem still persists, could you please share your .pbix file?
panel.background = element_rect(fill = "transparent",colour = NA), panel.grid.minor = element_blank(), panel.grid.major = element_blank(), plot.background = element_rect(fill = "transparent",colour = NA))
panel.background = theme_rect(fill = "transparent",colour = NA), panel.grid.minor = theme_blank(), panel.grid.major = theme_blank(), plot.background = theme_rect(fill = "transparent",colour = NA)
Best Regards,
Herbert
I still have the same issue. I can't see how to upload a pbix, but here's the full code behind the visual.
"audience" is a text column providing the labels for my x-axis
"overlap" is an integer used to size the data points
"gindex" is a decimal, plotted on the y-axis
"indexColor" is either 1 or -1 and is used to colour the circles.
dataset <- data.frame(audience, overlap, gindex, indexColor) library(ggplot2) rescale <- function(x,over=dataset$overlap,minSize=5,maxSize=40) { x <- log(x) over <- log(over) rng <- range(over) ((x-rng[1])/(rng[2]-rng[1])) * (maxSize-minSize) + minSize } g <- ggplot(dataset,aes(audience,gindex)) #Lines g <- g + geom_segment(aes(xend=audience,yend=0),linetype="dashed",size=1.5) #Circles g <- g + geom_point(aes(size=rescale(overlap),colour=indexColor)) + scale_size_identity() + scale_colour_gradientn(colours=c("#FF0000","#00FF00")) #Ensure circles fit at top of plot (20 = maxSize used in rescale()/2) and # remove gap between y-axis bottom of plot area g <- g + scale_y_continuous(limits = c(0,max(dataset$gindex)+20), expand = c(0, 0)) #Labels for index values g <- g + geom_text(aes(label=gindex), fontface = "bold") #Remove unwanted styling, # Adjust axis labels # g <- g + theme_void() + theme( axis.text.x = element_text(angle = 45,size=11,vjust=0.9), legend.position="none", panel.background = element_rect(fill = "transparent",colour = NA), panel.grid.minor = element_blank(), panel.grid.major = element_blank(), plot.background = element_rect(fill = "transparent",colour = NA) ) par(bg="transparent") g
Hi
Do you solve the problem?
I have the same issue,too.
If you have already solved the problem, could you send me the method by email, cy-song@163.com ,please.
Thank you so much
Thanks Ankit. I do have that option set, but it just produces the result Herbert describes below.
User | Count |
---|---|
128 | |
108 | |
99 | |
65 | |
62 |
User | Count |
---|---|
136 | |
113 | |
102 | |
71 | |
60 |