MarcElosua/SPOTlight

spatial_scatterpie - col_df argument

MartaCasado opened this issue · 2 comments

Hi Marc!!

I am trying to change the colors in the spatial_scatterpie with the argument col_df and by passing to it a dataframe object containing a color for each cell type (first column is the cell type and the second is the color assigned to it), and I get the following error:

Error in SPOTlight::spatial_scatterpie(se_obj = spatial, cell_types_all = cell_types_all, :
unused argument (col_df = colors)

Thank you!

Hi @MartaCasado,

Sorry for this! I deprecated this argument and forgot to remove the argument description, thanks for reporting it!

To do what you are trying you can do the following:

SPOTlight::spatial_scatterpie(
  se_obj = spatial,
  cell_types_all = cell_types_all,
  img_path = "path/to/image.png",
  pie_scale = 0.4,
  slice = "image_id") +
  scale_fill_manual(
    values = col_df[col_df$cell_type %in% cell_types_all, "assigned_col"],
    breaks = cell_types)

Hope this helps you get the right coloring in your plots!
Let me know if this works or if I can help you further with this issue.

Yes, it works fine! Thank you Marc! :)