- iOS/Objective-C 元类和类别
- objective-c - -1001 错误,当 NSURLSession 通过 httpproxy 和/etc/hosts
- java - 使用网络类获取 url 地址
- ios - 推送通知中不播放声音
我正在使用 octave 3.8.1 Linux 的 compass
绘图函数绘制圆形数据集,但我很难更改此绘图的轴。
具体来说,我想删除一些轴点(例如 30 度和 60 度),而且我想更改数字(例如将 90 写成 30)。
有没有人知道如何做到这一点?
代码示例:连同它生成的图像
%compass plot
clear all,clc
x_angle=[45,90,123,43,53,23,53,12];
y_amp=[1,.5,.4,.1,.6,.3,.7,.3];
[x_cart,y_cart]=pol2cart([x_angle-180]*pi/180,y_amp);
h = compass(x_cart,y_cart);
for k = 1:length(x_cart)
a_x = get(h(k), 'xdata');
b_y = get(h(k), 'ydata');
%//To delete the arrows you need to delete all but the first two entries
%//in the xdata and ydata fields of the plot. The color can be changed
%//by setting the color property. Please find below a solution for
%//compass plots with arbitrary numbers of arrows.
set(h(k), 'xdata', a_x(1:2), 'ydata', b_y(1:2), 'color', 'r')
end;
最佳答案
这是一个 hack,因为 compass
图与我习惯的有点不同,但我们可以这样做:
您可以使用 findall
命令使用当前焦点图形(这是您的罗盘图),并将所有不需要的字符串替换为空白字符串。换句话说,如果您想删除图中所有具有 30
或 60
的实例,您可以这样做:
set(findall(gcf, 'String', '30', '-or', 'String', '60') ,'String', ' ');
这意味着您要设置数字,以便我们找到任何包含 30
或 60
的字符串,并将它们替换为空白字符串。注意空白字符串中有两个空格作为set
的最后一个参数。使用单个空格不起作用。如果你只想一次做一个标签,你可以这样做:
set(findall(gcf, 'String', '30'), 'String', ' ');
set(findall(gcf, 'String', '60'), 'String', ' ');
我们仍然可以使用上面相同的语法。但是,不要执行空白字符串,而是将其替换为您选择的字符串。对于您的示例,您希望将标签从 90
更改为 30
。因此:
set(findall(gcf, 'String', '90'), 'String', '30');
需要注意的一件好事是数字是字符串。将它们设置为实际数字不会有任何作用。
希望对您有所帮助!顺便说一句,在制作可重现的例子方面做得很好。它让我可以轻松地进行测试。
关于linux - 在 MATLAB 和 Octave 中更改罗盘轴,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24938458/
假设我们在 Octave 中运行以下命令集: pkg load symbolic %loads the symbolic math package syms x y %declare x and y
Octave中vec的逆运算是什么? 例如。如果我需要将12x1向量转换成3x4矩阵,该怎么办? 最佳答案 我不知道Octave,但我认为您正在寻找 reshape 。 — Built-in Func
我试图在向量中找到一个字符串。 例如:query = "ab"in vector = ["ab", "cd", "abc", "cab"] 问题是:当我使用函数 strfind(vector,quer
对于练习,我必须以 Octave 为单位创建函数 x^i 从 i=1 到 i=10 的动画图。绘图必须有一个动态的标题,曲线的颜色必须改变。目前我的代码如下: function exercicequa
有没有一种方法可以让 Octave 矩阵将字符串和数字放在一起? 我想要一个休闲类型的矩阵: A=["A","B","C","D";1,2,3,4;2,3,4,5;3,4,5,6;4,5,6,7];
事实上,我已经为此奋斗了大约两个月。是什么让这些有所不同? hypotheses= X * theta temp=(hypotheses-y)' temp=X(:,1) * temp temp=tem
我想在我的绘图中添加带有注释的文本或图例框。 目前我的图例绘制在东北外,我想将新的图例(或文本框)添加到东南外的位置。 谢谢! 最佳答案 缺乏有关您的案例的更多信息: 据我所知,一个坐标区对象只能有一
我想在我的绘图中添加带有注释的文本或图例框。 目前我的图例绘制在东北外,我想将新的图例(或文本框)添加到东南外的位置。 谢谢! 最佳答案 缺乏有关您的案例的更多信息: 据我所知,一个坐标区对象只能有一
我想在 Octave 中执行整数除法(我使用的是最新版本 5.1.0)。我厌倦了 idivide(5, 2, "round") 应该产生 3。 Documentation表示将 idivide 与 r
我正在尝试从矩阵中按行获取最大索引。为此,我正在做: [throwaway, indexes] = max(blah, [], 2); 变量“throwaway”会存储我不再需要且永远不会使用的值,我
我在启动 Octave 后收到以下警告。我使用了来自 here 的安装说明. 可能是什么问题?这些是主要警告吗?我正在使用 Windows。 warning: gmsh does not seem t
我一直在学习机器学习类(class),目前学习分类。我实现了分类算法并获得了参数和成本。该作业已经具有绘制决策边界的功能并且可以正常工作,但我试图阅读他们的代码但无法理解这些行。 plot_x = [
我正在尝试更改 octave 中的polar 图中标记的外观。 r = rand(1,10); % the radius t = 30*rand(1,10); % the angles polar(t
我正在尝试从 Octave 中的文件读取矩阵,但我找不到解决方案。 输入文件是: 4 1 4 2 3 1 4 2 1 4 2 1 4 1 2 1 3 其中 4 是行数和列数。我希望能够将该信息存储在矩
我正在运行 Octave 3.4.0 并想创建一个透明的曲面图。但是,我在处理 facealpha 时无法这样做。 , edgealpha , alphadata和 alphadatamapping
安装一个包后,查找该包中有哪些功能的命令是什么? 例如,我有 control安装包。但是如何找到关于这个包的帮助,比如它包含哪些函数等等,就像使用 Matlab 一样? 是否必须去http://oct
我正在尝试在 Octave 音程终端中打印一长串数字。 disp(vec); 我得到的 7.0931e-01 6.2041e-05 9.7740e-01 9.9989e-01 8.8428e-01 9
我试图在OS X上安装Octave。执行brew install octave时,出现以下错误: octave: A LaTeX distribution is required to install
有人知道如何在 Octave 中增加图例字体大小吗? 最佳答案 这对我有用(kubuntu 9.04, Octave 3.2.2) print("plot.eps","-deps", "-F:30")
我试图弄清楚如何增加命令窗口文本。 我想出了legend: legend('{\fontsize{10} Low }', '{\fontsize{10} Medium }', '{\fontsize{
我是一名优秀的程序员,十分优秀!