美文网首页
ggfx包给图片添加阴影

ggfx包给图片添加阴影

作者: R语言数据分析指南 | 来源:发表于2021-02-28 12:38 被阅读0次

ggfx软件包是由Thomas Lin Pedersen开发的一种在R绘图中访问像素级图像滤镜的方法,尤其是在使用ggplot2绘图时可以用来给图片添加阴影。喜欢的小伙伴可以关注我的公众号R语言数据分析指南,持续分享更多优质资源,后台回复关键词ggplot2获取一份绝佳ggplot2学习教程
链接:https://mp.weixin.qq.com/s/c8DXQXcP3-2HF6gup2xW7Q

安装最新版ggfx

devtools::install_github('thomasp85/ggfx')
library(ggfx)
library(ggplot2)
ggplot(mtcars, aes(x = mpg, y = disp)) +
  with_blur(geom_point(),sigma = unit(1, 'mm')) + 
  geom_smooth()
library(grid)
circle_left <- circleGrob(x = 0.25, y = 0.5, r = 0.2)
circle_right <- with_blur(circleGrob(x = 0.75, y = 0.5, r = 0.2),
                          sigma = unit(1, 'mm'))
grid.newpage()
grid.draw(circle_left)
grid.draw(circle_right)
checker <- expand.grid(x = 1:6, y = 1:6)
checker <- checker[checker$x %% 2 == checker$y %% 2, ]
ggplot() + as_reference(
    geom_tile(aes(x = x, y = y), checker),
    id = 'pattern') + with_blend(
    geom_text(aes(x = 3.5, y = 3.5, label = '🚀GGFX🚀'), size = 15),
    bg_layer = 'pattern',
    blend_type = 'xor')
ggplot() + with_blend(
    geom_tile(aes(x = x, y = y), checker),
    bg_layer = wave,blend_type = 'copy_red',
    alpha = 'src',id = 'wave-checker') +with_variable_blur(
    geom_abline(aes(intercept = -6:6, slope = 1)),
    x_sigma = ch_hue('wave-checker'),
    y_sigma = ch_luminance('wave-checker'),
    x_scale = unit(3, 'mm'))
ggplot(mtcars,aes(mpg,disp))+
  with_shadow(geom_smooth(alpha=1),singma=4)+
  with_shadow(geom_point(size=3),sigma=4)+
  theme_bw()
volcano_long <- data.frame(
  x = as.vector(col(volcano)),
  y = as.vector(row(volcano)),
  z = as.vector(volcano))

ggplot(volcano_long,aes(y,x))+
  as_reference(geom_raster(aes(alpha=z),fill="black",
                    interpolate=TRUE,show.legend=FALSE),id='height_map')+
           with_shade(geom_contour_filled(aes(z=z,fill=after_stat(level))),
height_map=ch_alpha('height_map'),azimuth=150,height=5)

相关文章

  • ggfx包给图片添加阴影

    ggfx软件包是由Thomas Lin Pedersen开发的一种在R绘图中访问像素级图像滤镜的方法,尤其是在使用...

  • Android 实现阴影效果总结

    图片添加阴影是为了突出图片的效果,有的设计师为了突出某部分的内容会给该部分添加阴影背景,常见的是给图片添加外阴影,...

  • iOS 图片添加阴影效果

    Code 圆形图片设置阴影(补充) < 设置图片圆角阴影

  • 图片添加阴影效果 - WinSnap

    平时写文章经常要在文中插入图片,但是当我们使用一些底色为白色、边缘不明显的图片时,图片四周容易和网页的白底色融为一...

  • 为图片添加投影阴影效果

    很多的博客都使用了图片投影效果,使得图片边框有阴影。 做法其实很简单,就是利用了 CSS3 中的 box-shad...

  • 添加阴影

    在Core Graphics中,使用两个过程对图形上下文应用阴影 1、CGContextSetShadow过程: ...

  • 添加阴影

    阴影view一定要上所有view的最上层,否则会被覆盖

  • 添加阴影

    ps: 以上3段代码就是下列的例子 ps: 阴影不能是clearColor,必须要有颜色ps: 阴影的圆角,实际就...

  • iOS UIView添加阴影

    UIView添加四边阴影效果 UIView添加单边阴影效果

  • css3新特性

    1.边框 使用css,可以创建新的圆角边框(border-radius),添加阴影框(box-shadow),图片...

网友评论

      本文标题:ggfx包给图片添加阴影

      本文链接:https://www.haomeiwen.com/subject/sdewfltx.html