Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/77.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R 放大ggplot2图例_R_Ggplot2 - Fatal编程技术网

R 放大ggplot2图例

R 放大ggplot2图例,r,ggplot2,R,Ggplot2,我在R中用ggplot2 由以下代码绘制: ggplot(mtcars) + geom_smooth(fill='grey', alpha=0.3, span=0.1, aes(x=mpg, y=hp, color='AAA',linetype='AAA')) + geom_smooth(fill='grey', alpha=0.3, span=0.9, aes(x=mpg, y=hp, color='BBB',linetype='BBB')) + scale_colour_ma

我在
R
中用
ggplot2

由以下代码绘制:

ggplot(mtcars) + 
  geom_smooth(fill='grey', alpha=0.3, span=0.1, aes(x=mpg, y=hp, color='AAA',linetype='AAA')) +
  geom_smooth(fill='grey', alpha=0.3, span=0.9, aes(x=mpg, y=hp, color='BBB',linetype='BBB')) +
  scale_colour_manual(name='test', values=c('AAA'='chocolate', 'BBB'='yellow')) +
  scale_linetype_manual(name='test', values=c('AAA'='dashed','BBB'='solid')) +
  theme_minimal() +theme(legend.position = "top") 
问题:从图例中不容易理解“AAA”线是虚线,因为框太小

我怎样才能放大它

我希望有类似的东西: 试试看

# create your legend guide
myguide <- guide_legend(keywidth = unit(3, "cm"))
# now create your graph
ggplot(mtcars) + 
  geom_smooth(fill='grey', alpha=0.3, span=0.1, 
              aes(x=mpg, y=hp, color='AAA',linetype='AAA')) +
  geom_smooth(fill='grey', alpha=0.3, span=0.9, 
              aes(x=mpg, y=hp, color='BBB',linetype='BBB')) +
  scale_colour_manual(name='test', 
                      values=c('AAA'='chocolate', 'BBB'='yellow'),
                      guide = myguide) +
  scale_linetype_manual(name='test',  
                        values=c('AAA'='dashed','BBB'='solid'), 
                        guide = myguide) +
  theme_minimal() + theme(legend.position = "top")  
#创建图例指南

myguide查看您可以在此处更改的图例主题