当前位置:网站首页>R language ggplot2 visualization: align the legend title to the middle of the legend box in ggplot2 (default left alignment, align legend title to middle of legend)
R language ggplot2 visualization: align the legend title to the middle of the legend box in ggplot2 (default left alignment, align legend title to middle of legend)
2022-07-26 09:36:00 【Data+Science+Insight】
R Language ggplot2 visualization : Set legend title (legend title) Align to ggplot2 In the middle of the legend box ( Default left alignment 、align the legend title to the middle of legend box in ggplot2)
# Simulation data
# example data from http://www.cookbook-r.com/Graphs/Legends_(ggplot2)/
df1 <- data.frame(
sex = factor(c("Female","Female","Male","Male")),
time = factor(c("Lunch","Dinner","Lunch","Dinner"), levels=c("Lunch","Dinner")),
total_bill = c(13.53, 16.81, 16.24, 17.42)
)
df1

# Set legend title (legend title) Align to ggplot2 In the middle of the legend box ( Invalid case )
# example data from http://www.cookbook-r.com/Graphs/Leg边栏推荐
猜你喜欢
随机推荐
Modern medicine in the era of "Internet +"
RMQ学习笔记
Windows backs up the database locally by command
VectorTileLayer更换style
Server and client dual authentication (2)
dll中的全局变量
POJ 1012 Joseph
Basic use of ArcGIS 1
莫队学习总结(二)
Fiddler download and installation
Global variables in DLL
服务器、客户端双认证
高斯消元求解矩阵的逆(gauss)
asp.net 使用redis缓存(二)
Fiddler下载安装
asp. Net using redis cache (2)
Network flow learning notes
mysql5.7.25主从复制(单向)
面试题目大赏
a-table中的rowSelection清空问题









