我想在 Gnuplot 中创建一个像箭头线这样的流线,我已经有了我需要的数据点,所以我认为我的问题与这篇文章所说的不同,与这篇文章不同,因为我已经获得了 stramlines 所需的数据.
我所做的是这样的:
所以红线是表示流场的矢量,绿线是流线,用来引导读者判断流量的方向。我的目标是在 GNUPLOT 中绘制所有蓝色大箭头。我已经知道如何像这篇文章一样绘制中间箭头,但是如果我想沿着线条绘制更多箭头,我需要做什么代码?
更详细地说,我如何绘制这样的图:
我在这里提供我的数据文件:
Velocity.txt用于矢量流场数据为“index,X,Y,vx,vy,particle-numbers”
line.txt用于简化数据为“X,Y”
我的 gnu 文件爆了:
set terminal postscript eps size 108,16 enhanced font "Arial-Bold,100"
set output 'vector.eps'
unset key
set tics
set colorbox
set border 0
set xtics 2
#set xlabel 'x'
#set ylabel 'y'
set xrange [0:108]
set yrange [0:16]
#set cbrange [0:40]
set nolabel
set style line 4 lt 2 lc rgb "green" lw 2
plot 'velcoity.txt' u 2:3:(250*$4):(250*$5) …
Run Code Online (Sandbox Code Playgroud) for i in range(1, 27):
temp=str(i)
print '%s'(temp.zfill(3))
Traceback (most recent call last):
File "<ipython console>", line 3, in <module>
TypeError: 'str' object is not callable
Run Code Online (Sandbox Code Playgroud)
我想知道为什么?
因为我希望输出像这样:
001
002
Run Code Online (Sandbox Code Playgroud)
..
021
Run Code Online (Sandbox Code Playgroud)
...
所以我用zfill
.但python告诉我它是" str
对象不可调用"如何解决它?
我想意识到的事情如下:
你看到axis.ticks的方向是向上的。
那么ggplot可以使axis.ticks的方向向上吗?
现在我可以意识到这一点
您可以使用Axis Attributes·hadley/ggplot2 Wiki·GitHub的命令看到axis.ticks.length已设置为零 但这不是我想要的,而且网上似乎很少有描述。
谢谢!
当我在R和类似Excel的电子表格软件(例如Gnumeric Spreadsheet和WPS)中对我的数据进行简单的线性拟合时,我遇到了一个奇怪的问题.
下面的数据是19对x和y
93.37262737 56200
101.406044 62850
89.27322677 56425
86.9458042 43325
70.54645355 42775
85.1936032 38375
72.10985 38376
73.54055944 22950
78.092 15225
71.30285 12850
70.03953023 18125
66.31068931 14200
93.39847716 13925
66.09695152 13225
70.6549 18125
76.43348868 14125
71.37531234 14875
85.7953977 19275
95.65012506 45375
Run Code Online (Sandbox Code Playgroud)
并保存在名为'data.csv'的文件中
我在x和y之间进行线性拟合.R脚本如下:
data<-read.csv("data.csv",col.names=c("x","y"))
# plot data
plot(data$x,data$y)
#Fit
lmodelx<-lm(data$y~data$x)
abline(lmodelx)
summary(lmodelx)
Run Code Online (Sandbox Code Playgroud)
这给出了这个结果:
Call:
lm(formula = data$y ~ data$x)
Residuals:
Min 1Q Median 3Q Max
-27855 -7151 -1314 6947 23014
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -48212.8 23691.0 …
Run Code Online (Sandbox Code Playgroud) u'The disclosure relates to systems and methods for detecting features on\n billets of laminated veneer lumber (LVL). In some embodiments, an LVL\n billet is provided and passed through a scanning assembly. The scanning\n assembly includes anx-raygenerator and anx-raydetector. Thex-raygenerator generates a beam ofx-rayradiation and thex-raydetector\n measures intensity of the beam ofx-rayradiation after is passes through\n the LVL billet. The measured intensity is then processed to create an\n image. Images taken according to the disclosure may then be analyzed todetectfeatures on …
Run Code Online (Sandbox Code Playgroud) 我正在编写一个程序,我需要程序返回一个整数说changed
来提醒控制器有一些变化.但是当我想要返回这个值时,我一直收到这条消息:
return 1
SyntaxError: 'return' outside function
Run Code Online (Sandbox Code Playgroud)
我在线阅读了一些帖子,他们都说这是缩进问题,但我确信我的缩进是正确的,因为我尝试过这么简单的程序,但失败仍然存在.
# -*- coding: utf-8 -*-
if __name__ == "__main__":
return 1
Run Code Online (Sandbox Code Playgroud)
这是错误消息:
runfile('/home/iphyer/untitled1.py', wdir='/home/iphyer')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 699, in runfile
execfile(filename, namespace)
File "/usr/local/lib/python2.7/dist-packages/spyderlib/widgets/externalshell/sitecustomize.py", line 81, in execfile
builtins.execfile(filename, *where)
File "/home/iphyer/untitled1.py", line 9
return 1
SyntaxError: 'return' outside function
Run Code Online (Sandbox Code Playgroud)
虽然我真正的程序比这更复杂,但结构是相同的.
我很困惑,因为如果我评论return
语句,所有程序都可以运行而没有任何警告.
这令人困惑.我想我不能使用if __name__ == "__main__
的return
一些价值?
谢谢!〜
我正在做我的作业以实现一个C程序,在我的工作中,我需要一个步骤来获得双重数字的整数部分.所以我选择ceil()或floor()来实现这一点.但输出是不可预测的,远非预期.
整个计划如下:
/*
************************************************************************
Includes
************************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#include <gsl/gsl_rng.h>
#include <time.h>
#include <math.h>
/* Solvent Particle Propersities*/
typedef struct
{
double vx,vy,rx,ry ; /* velocity AND position */
double cell; /* index of grid */
}solvent_p;
/* Cell Propersities*/
typedef struct
{
double vcm_x,vcm_y ; /* center of mass velocity */
int number; /* number of solvent in the cell */
double roation_angle; /* roation_angle of the cell */
}cell_p;
/* periodic boundary condition judging and …
Run Code Online (Sandbox Code Playgroud)