我是地质学家,我使用TAS图表来了解火山的发展。我想用这样的图制作固定的背景/模板:
在此背景下,我希望绘制实际数据,例如
这是我当前的代码,该代码使用ggplot制作TAS图,然后使用 var message = new MimeMessage();
message.From.Add(new MailboxAddress("Mohsen", "email@domain.com"));
message.To.Add(new MailboxAddress("DEw ", "receiving@domain.com"));
message.Subject = "SentFolder";
var builder = new BodyBuilder();
builder.HtmlBody = "Dear Colleague,<br /> ";
message.Body = builder.ToMessageBody();
message.Headers.Add((HeaderId) 1, "X-Save-Sent: 1");
using (var client = new SmtpClient())
{
client.Connect("mail.domain.com", 587, false);
client.Authenticate("UserName", "Password");
client.Send(message);
client.Disconnect(true);}
功能绘制数据
geom_point
在TAS模板上绘制数据,更改颜色指示器,形状指示器。添加了library(ggplot2)
#create blank dataframe for tas plot
d = data.frame(x = c(40, 80), y = c(0,15))
theme_set(theme_bw(base_size=28))
#makes the TAS template
p <- ggplot(data=d, mapping=aes(x=x, y=y)) +
geom_blank() +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank()) +
scale_y_continuous(limits=c(0,15), expand = c(0, 0)) +
scale_x_continuous(limits=c(40,80), expand = c(0, 0)) +
labs(y=expression(Na[2]*O + K[2]*O*~ wt~'%'), x=expression(SiO[2]*~ wt~'%'))+
annotate("segment", x=45, xend=45, y=1, yend=5)+
annotate("segment", x=45, xend=52, y=5, yend=5)+
annotate("segment", x=52, xend=69, y=5, yend=8)+
annotate("segment", x=76.5, xend=69, y=1, yend=8)+
annotate("segment", x=69, xend=69, y=8, yend=13)+
annotate("segment", x=45, xend=61.32, y=5, yend=13.7)+
annotate("segment", x=52, xend=52, y=1, yend=5)+
annotate("segment", x=57, xend=57, y=1, yend=5.9)+
annotate("segment", x=63, xend=63, y=1, yend=6.9)+
annotate("segment", x=52, xend=49.4, y=5, yend=7.3)+
annotate("segment", x=57, xend=53.05, y=5.9, yend=9.25)+
annotate("segment", x=63, xend=57.6, y=6.9, yend=11.7)+
annotate("segment", x=41, xend=45, y=3, yend=3)+
annotate("segment", x=41, xend=41, y=1, yend=3)+
annotate("segment", x=41, xend=41, y=3, yend=7, linetype="dashed")+
annotate("segment", x=41, xend=45, y=7, yend=9.4, linetype="dashed")+
annotate("segment", x=45, xend=52.5, y=9.4, yend=14)+
annotate("segment", x=49.4, xend=45, y=7.3, yend=9.4)+
annotate("segment", x=53, xend=48.4, y=9.3, yend=11.5)+
annotate("segment", x=57.6, xend=50.3, y=11.7, yend=15)
tas <- p + annotate("text", label = "Basalt", x = 48.5, y = 2, size=4)+
annotate("text", label = "Basaltic\n andesite", x = 54.8, y = 2.7, size=4)+
annotate("text", label = "Andesite", x = 60, y = 3.5, size=4)+
annotate("text", label = "Dacite", x = 67.5, y = 4.2, size=4)+
annotate("text", label = "Rhyolite", x = 72, y = 7, size=4)+
annotate("text", label = "Trachy- \n basalt", x = 48.8, y = 5.7, size=4)+
annotate("text", label = "Basaltic \n trachy- \n andesite", x = 52.5, y = 7, size=4)+
annotate("text", label = "Trachy- \n andesite", x = 57.8, y = 8.2, size=4)+
annotate("text", label = "Trachydacite", x = 65, y = 9, size=4)+
annotate("text", label = "Trachyte", x = 62.5, y = 11.5, size=4)+
annotate("text", label = "Picro- \n basalt", x = 43, y = 1.5, size=4)+
annotate("text", label = "Basanite \n (Ol > 10%)", x = 44, y = 6, size=4)+
annotate("text", label = "Tephrite \n (Ol < 10%)", x = 43.5, y = 7, size=4)+
annotate("text", label = "Phono- \n tephrite", x = 48.5, y = 9.5, size=4)+
annotate("text", label = "Tephri- \n phonolite", x = 52.5, y = 11.5, size=4)+
annotate("text", label = "Phonolite", x = 57, y = 14, size=4)+
annotate("text", label = "Foidite", x = 42, y = 12, size=4)
来显示不同的数据集:
geom_point