I\'m trying to generate some fractals and have a question regarding the margins with ggplot in R. I\'m using the following code to generate the fractals.
lib
After using your code, I see more clearly what you're looking for. This:
gg <- ggplot(data=df, aes(V1, V2, color=cl[V3]))
gg +
geom_point() +
labs(x = NULL, y = NULL, title = NULL) +
scale_x_continuous(expand = c(0, 0), limits = range(df$V1)) +
scale_y_continuous(expand = c(0, 0), limits = range(df$V2)) +
scale_colour_manual(values = sort(c("#00000000", rainbow(35)), decreasing = FALSE)) +
theme(
panel.background = element_rect(fill = "transparent", colour = NA),
plot.background = element_rect(fill = "transparent", colour = NA),
panel.grid = element_blank(),
panel.border = element_blank(),
plot.margin = unit(c(0, 0, 0, 0), "null"),
panel.margin = unit(c(0, 0, 0, 0), "null"),
axis.ticks = element_blank(),
axis.text = element_blank(),
axis.title = element_blank(),
axis.line = element_blank(),
legend.position = "none",
axis.ticks.length = unit(0, "null"),
axis.ticks.margin = unit(0, "null"),
legend.margin = unit(0, "null")
)
you have to remove the labels, not-expand the x & y axis and set hard limits. The nulls are also important.'
This can also be done by doing gb <- ggplotGrob(gg) and manually editing the grobs & parameters, but I think this probably gets you what you need.