Closed rwbaer closed 2 years ago
@rwbaer, as I mentioned previously, I would avoid using the RStudio zoom function as it creates lower resolution images that are commonly distorted.
Instead, you should open up a popup window with cyto_plot_new()
and expand it to be as big as you want before adding plots with cyto_plot()
:
cyto_plot_new(popup = TRUE) # expand window manually
cyto_plot(gs,
parent = "Single Cells",
channels = c("CD4", "CD8"))
If you are creating custom plot layouts as above, you should really be using cyto_plot_custom()
before calling cyto_plot()
. If you look at the docs for cyto_plot_layout()
you will see that it does support more complex layouts if supplied as a matrix - you can use this to give more space to your third panel:
# create layout
layout <- matrix(c(1,1,2,2,3,3,3,3), ncol = 4, nrow = 2)
layout # number correspond to panel ID
# create custom layout
cyto_plot_custom(layout = layout)
# add plots
cyto_plot(...)
cyto_plot(...)
cyto_plot(...)
# signal plot completion & reset layout
cyto_plot_complete(c(1,1)) # reset layout to be 1 x 1
You should also take a look at the margins
argument of cyto_plot()
which controls the amount of space around the plot.
See #27 for more details on creating complex layouts.
Is your feature request related to a problem? Please describe. When using the group_by argument with cyto_plot() it is likely that all graphs will share a common legend, but allocation of legend space seems to be done on the basis of each individual graph.
EDIT: looking at the figures again, I will note that on any given row of the composite plots, the Y-axis would appear to be redundant. as well as the legend for group_by plots. It might be nice to suppress it on all but the left most graph of each row as well.
Describe the solution you'd like It would be nice if total legend real estate were allocated before calculating the width of each graph. As it is, you need to repeat the legend for each graph if you wish to keep the plots the same size.
Describe alternatives you've considered I considered just allowing the legend to repeat. This is not only "not ideal" because of redundancy but causes the graphs themselves to become unusably narrow. I suppose another alternative would be to have a chance to place the legend manually somewhere on the composite graph.
Code to draw legends as shown
Additional context The graph below is the one drawn for issue #116 with the addition of a legend argument.
Note the disproportionately narrow 3rd graph in the RStudio graphics device.
The legend labels are cut off in the "zoom" view even though the plot itself looks more normal.