r - 使用 plotly 时,绘图未显示在查看器中
问题描述
尝试以 plotly 的第一次用户身份运行一些教程代码。但是,绘图不会出现在查看器窗格中,并且会生成以下消息(在查看器中):
/session/viewhtml36b8729177dc/index.html?viewer_pane=1&capabilities=1&host=http%3A%2F%... 未找到
使用的代码
library(tidyverse)
library(scales)
library(plotly)
recent_grads <- read_csv("https://raw.githubusercontent.com/fivethirtyeight/data/master/college-majors/recent-grads.csv")
majors_processed <- recent_grads %>%
arrange(desc(Median)) %>%
mutate(Major = str_to_title(Major),
Major = fct_reorder(Major, Median))
g <- majors_processed %>%
mutate(Major_category = fct_lump(Major_category, 4)) %>%
ggplot(aes(ShareWomen, Median, color = Major_category, size = Sample_size, label = Major)) +
geom_point() +
geom_smooth(aes(group = 1), method = "lm") +
scale_x_continuous(labels = percent_format()) +
scale_y_continuous(labels = dollar_format()) +
expand_limits(y = 0)
ggplotly(g)
> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18362)
plotly_4.9.2.1
RStudio 1.3.1073
对此的任何支持将不胜感激。
解决方案
推荐阅读
- powershell - 没有结果时,Powershell 的 Export-CSV 命令不包括标题(列名)
- operating-system - 为什么 CPU-OS 模拟器不按相同顺序运行循环算法?
- python - 如何确定我的输入层的形状?
- javascript - 增加 Sankey Highcharts 数据系列栏的高度
- javascript - 如何在函数中添加一个点(例如: lib.genarate() )
- xamarin - 如何在 Xamarin 中同时执行命令和按钮单击
- mysql - 如何使用 node.js 在 mySQL 中插入数组
- image - 如何在图像到 pdf 转换期间设置图像大小?
- python - 如何为移动的球设置动画
- php - 删除 Woocommerce 中的“添加到购物车”按钮,但保留变体