Whenever saving a figure in R in .EPS or .SVG format, the size of the file is too large to be incorporated in an environment like Overleaf. How can I reduce the size? It feels rather unnecessary for a simple figure to be 141 mb (!).
This involves figures from the ComplexUpset package which formats via ggplot2
upset(
M1_BinaryMatrix,
colnames(M1_BinaryMatrix),
sort_intersections_by='ratio',
intersections='all',
min_degree=2,
set_sizes=(
upset_set_size(position='right')
+ geom_text(aes(label=paste0(round((..count../nrow(M1_BinaryMatrix))*100), '%')), hjust=1.1, stat='count', color='white')
+ expand_limits(y=1000)
+ ylab("")
+ theme(axis.text.x = element_blank())
),
#
base_annotations=list(
'Intersection ratio'=intersection_ratio(text_mapping=aes(label=!!upset_text_percentage()))
# 'Intersection ratio'= intersection_ratio(text_mapping=aes(label=paste0(round(
# !!get_size_mode('inclusive_intersection')/!!nrow(head(M1_BinaryMatrix, 1000)) * 100
# ), '%')))
+ ylab("")
+ theme(axis.text.y=element_blank())
),
#
name="",
wrap=TRUE,
stripes=c(alpha('grey90', 0.45), alpha('white', 0.3)),
matrix = intersection_matrix(
geom=geom_point(
shape='square',
size=4
),
segment=geom_segment(
linetype='solid'
),
outline_color=list(
active='darkorange3',
inactive='grey70'
)
)
) + labs(title = "", caption = "")
The data frame has 10 M rows and 3 columns.