地块的标题

编程入门 行业动态 更新时间:2024-10-14 10:39:33
本文介绍了地块的标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试在Plotly中制作一个3x3子图的网格.我正在尝试为每个子图获取标题,并在顶部获取主要标题,但似乎无法正常工作. 我看到了这个很棒的网站,但我无法似乎找到了R的等效物.

I am trying to make a grid of 3x3 subplots in Plotly. I'm trying to get titles for each subplot and a main title on the top and I can't seem to get it to work. I see this wonderful site for Python but I can't seem to find its equivalent for R.

all <- subplot(graph1, graph2, graph3, graph4, graph5, graph6, graph7, graph8, graph9, nrows = 3)

这给了我我想要的网格,但是在子图上没有我想要的标题:

That gave me the grid I wanted but don't have the titles I want on the subplots:

1. Graph 1 2. Graph 2 3. Graph 3 4. Graph 4 5. Graph 5 6. Graph 6 7. Graph 7 8. Graph 8 9. Graph 9

,默认的主标题是图9.

and the the default Main Title was Graph 9.

有人可以协助吗?

推荐答案

您可以使用ggplot +来实现.这可以解决问题:

You could use ggplot + plotly to achieve it. This does the trick:

library(ggplot2) library(plotly) mtcars$main1 = "title1" mtcars$main2 = "title2" p1 = ggplot(mtcars, aes(x = mpg, y = cyl)) + geom_point() + facet_wrap(~main1) p2 = ggplot(mtcars, aes(x = disp, y = hp)) + geom_point() + facet_wrap(~main2) plotly::subplot(p1, p2 ,nrows = 1, margin = 0.23 ) %>% layout(title ="Main title")

更多推荐

地块的标题

本文发布于:2023-05-29 03:35:51,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/335847.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:地块   标题

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!