我想将geom_vridgeline与(连接的)折线图结合起来。
geom_line(和geom_point)的值来自不同的数据集。即它不是geom_vridgeline中使用的观测值的一瞬间(平均值,中位数等)。
我尝试了简单的操作geom_vridgeline(...)+ geom_line(data ...)+ geom_point(..)以及一些调整(添加第二个x轴等)。
GetUserConfigLambda:
Type: AWS::Lambda::Function
Properties:
Code:
ZipFile:
Fn::Sub: |
'use strict';
const https = require('https');
exports.handler = (event, context, callback) => {
const data = JSON.stringify({
username: event.username,
password: event.password
});
const options = {
hostname: '${Url}',
path: '/api/v1.0/users',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length
}
};
var policy = {
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:ListBucket",
"s3:GetBucketLocation"
],
"Effect": "Allow",
"Resource": [
"arn:aws:s3:::${transfer:HomeBucket}"
],
"Condition": {
"StringLike": {
"s3:prefix": [
"${transfer:HomeFolder}/*",
"${transfer:HomeFolder}"
]
}
}
},
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObjectVersion",
"s3:DeleteObject",
"s3:GetObjectVersion"
],
"Resource": "arn:aws:s3:::${transfer:HomeDirectory}*"
},
{
"Action":[
"s3:PutObject"
],
"Effect":"Deny",
"Resource":"arn:aws:s3:::${transfer:HomeDirectory}/*/"
}
]
}
var req = https.request(options, (res) => {
console.log("Status code: ", res.statusCode);
let data = '';
res.on('data', (chunk) => {
data += chunk;
}).on('end', () => {
let response = JSON.parse(data);
let lambdaResponse = {};
if('data' in response &&
'name' in response['data']) {
lambdaResponse = {
// Required.
Role: 'arn:aws:iam::669858054894:role/${UserRole}',
// JSON blob which further restrict this user's permissions.
Policy: JSON.stringify(policy),
// Home directory is a concatenation of home bucket and integration name.
HomeDirectory: "/${SftpS3Bucket}/" + response['data']['name'],
// Name of home bucket.
HomeBucket: "${SftpS3Bucket}"
}
}
callback(null, lambdaResponse);
});
}).on("error", (err) => {
console.log("Error: ", err.message);
callback(null, {});
});
req.end(data);
};
类似这样
https://www.dropbox.com/s/1v7ycl23014hau8/Rplot.png?dl=1
注意:在我的真实示例中,x轴实际上是连续的。我假设一旦弄清楚如何添加geom_line,我也可以添加geom_point
非常感谢!
答案 0 :(得分:0)
ggplot() +
geom_line(data=df,mapping=aes(x=Species,y=newvar,group = 1)) +
geom_vridgeline(data=iris, aes(x=Species, y=Sepal.Width, width = ..density.., fill=Species),stat="ydensity", trim=FALSE, alpha = 0.85, scale = 0.25)