在scale_y_continuous()函数中使用参数sec.axis = sec_axis(~.*coeff, name="..."))来添加右侧 ...
axes = "all_y") + scale_y_continuous(sec.axis = dup_axis(name = NULL)) + theme...
跟着Plos Biology学作图:R语言ggplot2双Y轴折线图、置信区间、误差线
现在ggplot2有了辅助轴支持,这在许多(但不是全部)情况下变得容易得多。无需杂项操作。
Furthermore, note that the y-axis is not representing the values shown on the line properly. Let’s fix this! Example 2: Add Secondary Y-Axis to ggplot2 Plot This example shows how toadd a second y-axisto our plot, which represents the values of the line that we have annotated in ...
(color = category), size = 3) + geom_text(aes(label = label), nudge_x = 0.1, check_overlap = TRUE) + geom_text(aes(label = category), nudge_y = 0.1, color = "black") + labs(title = "Scatter Plot with Double Annotations", x = "X Axis", y = "Y Axis") + theme...
77-turn-y-axis-upside-down.html 78-levelplot-from-a-square-matrix.html 79-levelplot-with-ggplot2.Rmd 79-levelplot-with-ggplot2.html 81-barplot-with-variable-width.Rmd 81-barplot-with-variable-width.html 82-boxplot-on-top-of-histogram.Rmd 82-boxplot-on-top-of-histogram.htm...
## age : double ## pop : integer ## pop_rate: double ## > ## >[2]> ## [[1]] ## # A tibble: 19 x 4 ## sex age pop pop_rate ## <chr> <dbl> <int> <dbl> ## 1 男性 0 -193565 -1.13 ## 2 男性 1 -924420 -5.42 ...
(doublex) {returnx/(1+x); };autogg = statFunction(f,0,10.0) .geomLine .putIn(GGPlotD());//Setting range and label for xaxisgg.put(xaxisRange(0,8) ).put( xaxisLabel("My xlabel") );//Setting range and label for yaxisgg.put(yaxisRange(0,2.0) ).put( yaxisLabel("My ylabel"...
(location="bl") + #添加比例尺annotation_north_arrow(location="tl", which_north = "false",style=north_arrow_fancy_orienteering)+#添加指北针theme_minimal()+theme(legend.position=c(0.25,0.1),legend.direction='horizontal',axis.title=element_blank(),plot.title=element_text(size=22),plot.back...