使用plotmath在指数括号内写上标,例如类似泊松的乘法方程式

时间:2018-10-31 13:58:56

标签: r plotmath

如何使用plotmath功能向情节中添加类似Poisson的乘法方程式?或者,由于我真的很接近,如何在没有指数.的情况下写这个方程式?我尝试了phantom,但是没有用(或者我没有正确使用它)。

这在循环过程中用于绘制许多图,因此具有交换数字和标签的能力是关键。

#   ---- Covariate names.
covar1 <- "var1"
covar2 <- "var2"

#   ---- Some numbers.  
beta0 <- 2.654
beta1 <- -0.084
beta2 <- 1.123

#   ---- A boring plot.  
plot(seq(0,100,1),seq(0,100,1))

#   ---- How to do this without the %.% ?
text(60,20,bquote(paste("Eqn: ","y = ",.(beta0),plain(e)^{.(beta1) %.% "X" [.(covar1)] + .(beta2) %.% "X" [.(covar2)] })))

应为以下公式:y = 2.654e ^ {-0.084X_var1 + 1.123X_var2}。

我如何摆脱圆点?

How to get rid of the dots?

1 个答案:

答案 0 :(得分:1)

这是一种解决方法-重现括号内的const char* port = "888"; char message[50] = {0}; // Initialize WINSOCK WSADATA wsaData; WSAStartup(MAKEWORD(2,2), &wsaData); // Create the listening socket SOCKET DataSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); // Initialize the sample struct and get another filled struct of the same type and old values addrinfo hints, *result(0); ZeroMemory(&hints, sizeof(hints)); hints.ai_family = AF_INET; hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; hints.ai_flags = AI_PASSIVE; getaddrinfo(0, port, &hints, &result); // Bind the socket to the ip and port provided by the getaddrinfo and set the listen socket's type to listen bind(DataSocket, result->ai_addr, (int)result->ai_addrlen); listen(DataSocket, SOMAXCONN); // Only sets the type to listen ( doesn't actually listen ) // Free unused memory freeaddrinfo(result); // Recieve data while(true){ int bytes = recvfrom(DataSocket, message, 20, 0, 0, 0); }

paste

enter image description here