简体   繁体   English

如何使用ggplot将两个不同比例的y轴放在绘图的同一侧?

[英]How to put two y-axis with different scale on the same side of the plot with ggplot?

I have three variables (Precipitation, Temperature and PAR Radiation) with different scales.我有三个不同尺度的变量(降水、温度和 PAR 辐射)。 I'm trying to plot these three variables together and I put the daily sum of precipitation represented by a barplot on the left side y axis and the daily average of temperature on the right side y axis.我试图将这三个变量绘制在一起,并将条形图表示的日降水量总和放在左侧 y 轴上,将每日平均温度放在 y 轴上。 I'd like to put another y axis on the right side, with another scale, in order to represent the daily average of PAR radiation, but I can't.我想在右侧放置另一个 y 轴,使用另一个刻度,以表示 PAR 辐射的日平均值,但我不能。 I'm using the ggplot package, because it is useful for other reasons.我正在使用 ggplot 包,因为它因其他原因而有用。

I'm trying to reach something similar as in the pic:我试图达到与图片类似的东西:

我试图达到与图片类似的东西

A discussion of this topic can be found here: 可在此处找到有关此主题的讨论:

ggplot with 2 y axes on each side and different scales ggplot,每侧有2个y轴,不同的刻度

A workaround solution can be found here: 可在此处找到变通方案解决方案:

https://rpubs.com/MarkusLoew/226759 https://rpubs.com/MarkusLoew/226759

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何 plot 两个 Y 轴刻度相同但值不同的图 - How to plot two graphs with same Y-axis scale but different values ggplot2-如何使用主要和次要y轴在同一图上对具有不同比例的两个变量进行箱图绘制? - ggplot2 - How to boxplot two variables with different scales on same plot using a primary and secondary y-axis? 在同一y轴上绘制两条线; Ggplot,R - Plot two lines on the same y-axis; Ggplot, R 如何在同一面板的同一X轴上绘制具有两个不同y轴范围的点? - How do I plot points with two different y-axis ranges on the same panel in the same X axis? 如何在具有一个x轴和两个y轴的图中将误差线缩放到右y轴的尺寸 - How to scale the errorbars to the dimensions of the right y-axis in a plot with one x-axis and two y-axis ggplot2:y 轴上有两个变量(以相同比例测量)的散点图:如何更改美学并添加单独的回归线? - ggplot2: scatterplot with two variables (measured on the same scale) on the y-axis: how do I change the aesthetics & add seperate regression lines? ggplot轴:图的左侧和右侧不同的y轴 - ggplot axis: different y-axis on left and right of plot 如何在R中用ggplot2制作的图的y轴刻度中准确显示数字的SI前缀? - How to accurately display SI prefix for numbers in y-axis scale of plot made with ggplot2 in R? 如何在 ggplot2 中在 x 轴上绘制两个向量,在 y 轴上绘制另一个向量 - How do you plot two vectors on x-axis and another on y-axis in ggplot2 ggplot 对于两个不同的数据集有两个不同的 y 轴 - ggplot wih two different y-axis for two different datasets
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM