无法在Gnuplot中绘制矩阵 [英] Can`t plot matrix in Gnuplot

查看:116
本文介绍了无法在Gnuplot中绘制矩阵的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在文件中保存了一个1和0的矩阵.看起来像这样:

I have a matrix of 1s and 0s saved in file. It looks like this:

    0 0 0 0 0 0 0 0 0 0 
    0 0 0 0 0 0 0 0 0 0 
    0 0 0 0 0 0 0 0 0 1 
    0 0 0 0 0 0 0 0 0 0 
    0 0 0 0 0 0 0 1 1 0 
    0 0 0 0 0 1 1 0 0 0 
    1 1 1 1 1 0 0 0 0 0 
    0 0 0 0 0 0 0 0 0 0 
    0 0 0 0 0 0 0 0 0 0 
    0 0 0 0 0 0 0 0 0 0 

我正在尝试使用以下命令在gnuplot中进行绘图:

I am trying to plot in gnuplot using command:

    plot 'data.rtf' matrix with image

但是当我这样做时,我得到一个错误:

but when I do that I get an error:

    warning: matrix contains missing or undefined values
    Matrix does not represent a grid

我想我应该得到一个图像,其中0是空白,而1是黑色.我是gnuplot的新手,所以我不知道可能是什么问题,或者我是否使用正确的方法来做到这一点.我将不胜感激.谢谢.

I think I should get an image where 0 is white space and 1 is black space. I am new to gnuplot so i have no idea what might be wrong nor if i am using correct way to do it. I will be grateful for any help. Thanks.

推荐答案

您的文件是rtf(富文本格式)文件,是gnuplot无法理解的标记语言格式.您需要在文本编辑器(而不是文字处理程序)中创建文件才能使用它.

Your file is an rtf (rich text format) file which is a markup language format, which gnuplot will not understand. You will need to create the file in a text editor (not a word processor) in order to be able to use it.

您提供的文件如下:

{\rtf1\ansi\ansicpg1250\cocoartf1404\cocoasubrtf340
{\fonttbl\f0\fnil\fcharset0 Menlo-Regular;}
{\colortbl;\red255\green255\blue255;}
\paperw11900\paperh16840\margl1440\margr1440\vieww10800\viewh8400\viewkind0
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\partightenfactor0

\f0\fs22 \cf0 \CocoaLigature0 0 0 0 0 0 0 0 0 0 0\
0 0 0 0 0 0 0 0 0 0\
0 0 0 0 0 0 0 0 0 1\
0 0 0 0 0 0 0 0 0 0\
0 0 0 0 0 0 0 1 1 0\
0 0 0 0 0 1 1 0 0 0\
1 1 1 1 1 0 0 0 0 0\
0 0 0 0 0 0 0 0 0 0\
0 0 0 0 0 0 0 0 0 0\
0 0 0 0 0 0 0 0 0 0

请注意,它以一堆标记文本开头. Gnuplot设计用于处理文本文件,而不用于格式化文本或二进制文件(有一些例外情况).

Notice that it starts with a bunch of markup text. Gnuplot is designed to work with text files and not formatted text or binary files (with some limited exceptions).

创建一个包含您设计的矩阵的文本文件就可以了.

Creating a text file containing your designed matrix will work just fine.

这篇关于无法在Gnuplot中绘制矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆