Skip to content

Commit

Permalink
fix min opacity in legend
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Mazin committed Nov 7, 2024
1 parent 8c937be commit f70e1f4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions R/visium.graphics.R
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ plotVisiumRect = function(xy,cex=1,col='red',border=NA,xlab='x',ylab='y',
#' @param cols colors to be used for columns in z
#' @param zfun function to transform values in z (z^2 is default)
#' @param scale.per.colour logical, specifies whether each color should cover whole range (that is, should z be scaled per column)
#' @param min.opacity minimal spot opacity. Default is 0, that means that spots with low intensity of all features will be almost transparent. Set it higer if you want at least one feature to be visible in each spot.
#' @param min.opacity int from 0 to 255. Minimal spot opacity. Default is 0, that means that spots with low intensity of all features will be almost transparent. Set it higer if you want at least one feature to be visible in each spot.
#' @param title.adj legend title adj (to be passed to text function)
#' @param legend.ncol number of legend columns. Set to 0 to suppress legend plotting.
#' @param ... other parameters to be passed to plotVisium
Expand Down Expand Up @@ -446,8 +446,10 @@ plotVisiumMultyColours = function(v,z,cols=NULL,zfun=function(x)x^2,scale.per.co

fullzlim = range(z)

min.opacity.hex = substr(rgb(min.opacity,1,1,maxColorValue = 255),2,3)

for(i in 1:length(cols)){
col1 = paste0(cols[i],'00')
col1 = paste0(cols[i],min.opacity.hex)
col2 = paste0(cols[i],'FF')
r = (i-1) %% legend.nrow
c = (i-1) %/% legend.nrow
Expand Down
1 change: 1 addition & 0 deletions man/plotConditionsProfiles.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions man/plotVisium.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/plotVisiumMultyColours.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit f70e1f4

Please sign in to comment.