我经常使用 Octave 创建数据,我可以根据我的实验室结果绘制这些数据。然后将该数据与 gnuplot 中的某些函数进行拟合:
f1(x) = a * exp(-x*g);
fit f1(x) "c_1.dat" using 1:2:3 via a,g
Run Code Online (Sandbox Code Playgroud)
这将创建一个fit.log:
*******************************************************************************
Tue May 8 19:13:39 2012
FIT: data read from "e_schwach.dat" using 1:2:3
format = x:z:s
#datapoints = 16
function used for fitting: schwach(x)
fitted parameters initialized with current variable values
Iteration 0
WSSR : 12198.7 delta(WSSR)/WSSR : 0
delta(WSSR) : 0 limit for stopping : 1e-05
lambda : 14.2423
initial set of free parameter values
mu2 = 1
omega2 …Run Code Online (Sandbox Code Playgroud) 我需要使用 gnuplot 在 .dat 文档中绘制数据。我试图绘制的数据在文件 outfile.dat 中表示,如下所示(一个小示例):
0.900 500.000 100.000
1.900 500.000 100.000
2.900 500.000 100.000
3.900 500.000 100.000
4.900 500.000 100.000
5.900 500.000 100.000
6.900 500.000 100.000
7.900 500.000 100.000
8.900 500.000 100.000
9.900 500.000 100.000
10.900 500.000 100.000
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,每列之间都有一个制表符分隔。根本不是什么罕见的角色。当我尝试用以下命令绘制该文件时
plot "outfile.dat" using 1:2
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
libplot error: flinewidth: invalid operation
plot: an unrecognized command `0x9' was encountered in the input
plot: the input file `salida.dat' could not be parsed
Run Code Online (Sandbox Code Playgroud)
为什么我会收到此错误?我做错了什么?谢谢。
我必须在 linux 中用 gnuplot 做一些绘图,但我不知道如何在 gnuplot 中更改目录,因为终端中的 cd 不起作用。
我有以下数据文件:
denst densu densd denss
3 1 1 1
4 1 1.5 1.5
5 1 2.5 1.5
Run Code Online (Sandbox Code Playgroud)
我可以将densu(denst)绘制为:
plot 'file.txt' u 'denst':'densu'
这是非常方便的语法。但是,如果我想绘制和的densu和的总和densd,就denst我能做到的唯一方法是:
set key autotitle columnhead 告诉gnuplot第一行是标题而不是数据
plot 'file.txt' u 1:($2+$3) 绘制
问题是我该如何使用这样的列值进行操作,但要使用名称符号?实际文件是一个具有约40列的csv,手动计数哪个列是哪个数字非常繁琐,因此我可以使用$n语法对列数据进行数学运算。
我想做类似的事情plot 'file.txt' u 1:($'densu'+$'densd'),使用标题名称语法类似于使用列号语法的方式。有什么办法吗?
在 Windows 10 下,如何通过命令行参数指定 gnuplot 的窗口位置(X,Y)和窗口大小(宽度,高度)?
应用程序的路径是
D:\gnuplot\bin\wgnuplot.exe
Run Code Online (Sandbox Code Playgroud)
如何用它指定窗口位置和大小?就像 cygwin mintty 一样:
D:\cygwin\bin\mintty.exe -i /Cygwin-Terminal.ico
-p 372,12 -s 135,50 -o Font=Consolas -o FontHeight=13 -
Run Code Online (Sandbox Code Playgroud)
show version long输出
Version 5.2 patchlevel 0 last modified 2017-09-01
Compile options:
+READLINE -LIBREADLINE +HISTORY
-BACKWARDS_COMPATIBILITY +UNICODE +OBJECTS +STATS +EXTERNAL_FUNCTIONS
+LIBCERF +GD_PNG +GD_JPEG +GD_TTF +GD_GIF +ANIMATION
-USE_CWDRC +USE_MOUSE +HIDDEN3D_QUADTREE
MAX_PARALLEL_AXES=13
Run Code Online (Sandbox Code Playgroud)
PS
我的意思是 gnuplot 的窗口,而不是它绘制的图形。
我有一个函数,假设f(theta, phi) = sqrt(1 - (sin(theta)*sin(phi))**2) + 5 * sqrt(1 - (sin(theta)*cos(phi))**2)我想在球体表面绘制颜色图。但是,我不知道如何splot在不首先生成表中包含适当值的文件的情况下将这个函数输入到其中以实现此目的。
我怎样才能gnuplot做到这一点?
我正在尝试使用一个名为 plot 的端点设置一个简单的 actix-web 服务器。它本质上只是消耗一些数据,用 gnuplot 绘制它并返回结果 PNG 的字节。问题是,正如您将在代码中看到的那样,我还没有找到一种方法可以在内存中完成所有这些操作,这意味着我必须将文件持久保存到磁盘,将其重新打开到阅读器中,然后将响应发回。根据并发级别,我将开始获取{ code: 24, kind: Other, message: "Too many open files" }消息。
有谁知道我将如何做到这一点,以便整个过程在内存中完成?我在用:
actix-web = "3"
gnuplot = "0.0.37"
image = "0.23.12"
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激,这是代码:
use actix_web::{post, web, App, HttpResponse, HttpServer, Responder};
use gnuplot::{AxesCommon, Color, Figure, LineWidth};
use image::io::Reader;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use std::any::type_name;
use std::collections::HashMap;
use std::fs;
#[post("/")]
async fn plot(req_body: web::Json<HashMap<String, Vec<f64>>>) -> impl Responder {
let data = req_body.get("data").unwrap();
let mut fg = Figure::new();
let fid: String = …Run Code Online (Sandbox Code Playgroud) 是否可以使用 Julia Plots 包重现此图? 使用 gnuplot 绘图
x = y = -15:0.4:15
f1 = (x,y) -> @. sin(sqrt(x*x+y*y))/sqrt(x*x+y*y)
surf(x, y, f1, w = :p, marker = "dot", Axes(hidden3d = :on))
Run Code Online (Sandbox Code Playgroud)
我需要创建一个带有中间 x 轴和上方和下方两个正 y 轴的条形图。它应该看起来像SAS 中的蝴蝶图,但调换了 x 和 y 轴。我的数据是雄性和雌性鱼的长度。
样本数据:
length <- c(12,13,15,14,13,16,18)
sex<-c("m","m","m","f","f","f","f")
dat=data.frame(length,sex)
Run Code Online (Sandbox Code Playgroud)