![ggplot multipanel figure different legend different sizes ggplot multipanel figure different legend different sizes](https://dyerlab.github.io/applied_population_genetics/amg_files/figure-html/fourway-autocorrelation-plot-1.png)
Sometimes ggplot may not be the best tool for the job. Guide = guide_legend(keywidth = grid::unit(1.2, "cm"))Ĭreated on by the reprex package (v0.2.0). Scale_size_c % rename_geom_aes(new_aes = c("size" = "edge_size"))) +Īes(x = ord, y = brand, node_size = thick), # make aesthetics aware size scale, also use better scaling Library(relayer) # install.github("clauswilke/relayer")
![ggplot multipanel figure different legend different sizes ggplot multipanel figure different legend different sizes](https://i1.wp.com/cmdlinetips.com/wp-content/uploads/2019/10/ggplot2_default_legend_title.png)
Using a highly experimental package I put together: library(ggplot2) # >= 2.3.0 How can I force ggplot to show more levels on the legend? PD2: I've found another problem, thin points aren't scaled properly and sometimes is impossible to force ggplot to show a proper legend: PD: Any solution with lattice or any alternative able to be exported as svg or vectorial pdf? Though I prefer the original approach with widths because in my real plot I'll have many lines crossing. Geom_point(data=nodes,aes(x=ord, y=brand, size=thick), color="black", shape=16,show.legend = T) + I can try using colors instead of widths: ggplot()+ geom_segment(data=edge, aes(x=ord1, y=brand1, xend=ord2, yend=brand2, alpha=N2/N1), size=1 ,show.legend = T) + I got the legend but it overlaps with the other one.
![ggplot multipanel figure different legend different sizes ggplot multipanel figure different legend different sizes](https://www.datanovia.com/en/wp-content/uploads/dn-tutorials/ggplot2/figures/026-ggplot-legend-guides-remove-legend-1.png)
Scale_x_continuous(limits = c(1, 4), breaks = 0:4, ggplot() +Īes(x = ord1, y = brand1, xend = ord2, yend = brand2, size = N2/N1), I would like to add another legend (below the nodes) relating the width of the segments and N2/N1.įollowing some of your suggestions. Imagine I plot this toy data: lev <- c("A", "B", "C", "D") Geom_segment(data = df3, aes(x = 1, xend = 9, y = a + b, yend = a + b*9)) + #geom_abline(aes(intercept=a, slope=b), data=df3) +
#Ggplot multipanel figure different legend different sizes code
# to add the code of extra segment (see <-), in red. # you could separately modify the dataframe of intercepts & slope, or Geom_abline(aes(intercept=a, slope=b), data=df3) + First, create a separate data frame housing intercepts and slope.