一个图中的每个轴是否有单独的因子水平?
我正在尝试绘制源国家和同行国家之间的金融流量图。
ggplot(dat_ggforce, aes(x=x, id=id, split = y, value=yvalue)) +
geom_parallel_sets(aes(fill = cpcountryname), alpha = alpha, axis.width = 0.2,
n=100, strength = 0.6)
但是,我使用因子水平订购了全国名称和cpcountryname
dat$countryname <- factor(dat$countryname, levels = c("Indonesia", "Malaysia", "Philippines", "Singapore", "Thailand"))
dat$cpcountryname <- factor(dat$cpcountryname, levels = c("United States","United Kingdom","Japan","Malaysia", "Others")
,因为马来西亚在左侧和右轴上,马来西亚突然突然覆盖了右轴:
编辑:交易对手国家的订单基于流量大小(US&GT; UK&GT; JP&GT; ME,然后是其他人)。马来西亚应在日本的右轴上以下,如CPCountryname的因子水平所示,但一直处于最高水平。
Edit2:我已经缩小了问题。我的实际问题是,是否可以在一个图中为每个轴具有单独的因子水平吗?
I'm trying to plot a Sankey diagram of financial flows between a source country and counterpart country.
ggplot(dat_ggforce, aes(x=x, id=id, split = y, value=yvalue)) +
geom_parallel_sets(aes(fill = cpcountryname), alpha = alpha, axis.width = 0.2,
n=100, strength = 0.6)
I order countryname and cpcountryname using factor levels
dat$countryname <- factor(dat$countryname, levels = c("Indonesia", "Malaysia", "Philippines", "Singapore", "Thailand"))
dat$cpcountryname <- factor(dat$cpcountryname, levels = c("United States","United Kingdom","Japan","Malaysia", "Others")
However, because Malaysia is in both the left and right axis, Malaysia suddenly overrides the right axis, as such:
Edit: The order for counterparty country is based on flow size (US > UK > JP > MY, then others). Malaysia should be below Japan on the right axis as seen in the factor levels for cpcountryname, but keeps moving to the top.
Edit2: I have narrowed the problem. My actual question is, is it possible to have separate factor levels for each axis in one graph?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论