EvaYiwenWang / PLSDAbatch_workflow

17 stars 8 forks source link

Error in Scatter_Density #5

Closed kennyyeo13 closed 2 years ago

kennyyeo13 commented 2 years ago

Hi Eva,

I am trying to plot a Scatter_Density. I have collected more than 30 datasets and wanted to use this to adjust for batch effects. I have followed the format of your datasets. However, there seems to be an error in 'check_aesthetics'. Hope you can help!

Thanks Kenny

Below is the error message for rlang::last_error() and rlang::last_trace(). Error in check_aesthetics(): ! Aesthetics must be either length 1 or the same as the data (2315): colour

Backtrace:

  1. PLSDAbatch::Scatter_Density(...)
  2. ggplot2::layer_scales(pMain)
  3. ggplot2:::ggplot_build.ggplot(plot)
  4. ggplot2 by_layer(function(l, d) l$compute_aesthetics(d, plot))
  5. ggplot2 f(l = layers[[i]], d = data[[i]])
  6. l$compute_aesthetics(d, plot)
  7. ggplot2 f(..., self = self)
  8. ggplot2:::check_aesthetics(evaled, n) Run rlang::last_trace() to see the full context.

rlang::last_trace() Backtrace: ▆

  1. └─PLSDAbatch::Scatter_Density(...)
  2. └─ggplot2::layer_scales(pMain)
  3. ├─ggplot2::ggplot_build(plot)
  4. └─ggplot2:::ggplot_build.ggplot(plot)
  5. └─ggplot2 by_layer(function(l, d) l$compute_aesthetics(d, plot))
  6. └─ggplot2 f(l = layers[[i]], d = data[[i]])
  7. └─l$compute_aesthetics(d, plot)
  8. └─ggplot2 f(..., self = self)
  9. └─ggplot2:::check_aesthetics(evaled, n)
    1. └─rlang::abort(...)
kennyyeo13 commented 2 years ago

I removed some dataset, and keep my vector <25 and it worked.

I was wondering if there will be an option in the future to be able to include more Color Palette ?

EvaYiwenWang commented 2 years ago

I removed some dataset, and keep my vector <25 and it worked.

I was wondering if there will be an option in the future to be able to include more Color Palette ?

Many thanks for your suggestion Kenny! I will update it recently.

Kind regards, Eva

EvaYiwenWang commented 2 years ago

I removed some dataset, and keep my vector <25 and it worked.

I was wondering if there will be an option in the future to be able to include more Color Palette ?

Hey Kenny!

If you need more than 25 colors, we recommend to use the option color.set within the function Scatter_Density(). You can list your own color first, then replace the color palette built in. See the second example within the help file of Scatter_Density() for details.

Kind regards, Eva