Plot 0s & 1s Matrix in GNUplot: Solve "No Usable Data" Error

Click For Summary

Discussion Overview

The discussion focuses on troubleshooting a "No Usable Data" error encountered while attempting to plot a 50x50 matrix of 0's and 1's using GNUplot. Participants explore potential issues related to file formatting and command syntax in the context of data visualization.

Discussion Character

  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant describes the error message received when trying to plot the data, indicating issues with file readability and undefined x values.
  • Another participant suggests posting the code and attaching the text file for better assistance.
  • A participant shares the command they entered into GNUplot, mentioning attempts with different spacings in the .txt file.
  • One participant realizes they entered an incorrect file path, which may contribute to the error.
  • A later reply provides an example of a correctly formatted data file for plotting, highlighting the importance of matching the expected format and the implications of grid data irregularities.

Areas of Agreement / Disagreement

Participants express uncertainty about the correct file format and the specific cause of the error. There is no consensus on a definitive solution, as multiple factors may be contributing to the issue.

Contextual Notes

Participants note the importance of file formatting and spacing, as well as the need for consistent data structure in the input file. There are unresolved questions regarding the specific requirements for the data file to be successfully read by GNUplot.

rolotomassi
Messages
52
Reaction score
0
I have a .txt file which is 50 rows x 50 columns filled with entirely 0's and 1's.

I have tried to plot the data with and without spaces between each column.

I keep getting this message:

gnuplot> splot 'C:\Users\raf\Desktop\PolymerProject\monte carlo code\directionInitial.txt' with pm3d
warning: Skipping unreadable file "C:\Users\raf\Desktop\PolymerProject\monte carlo code\directionInitial.txt"
warning: No usable data in this plot to auto-scale axis range
^
All points x value undefined

None of the advice online seems help/solve my problem. New to gnuplot so excuse me if this is obvious.
 
Technology news on Phys.org
rolotomassi said:
I have a .txt file which is 50 rows x 50 columns filled with entirely 0's and 1's.

I have tried to plot the data with and without spaces between each column.

I keep getting this message:

gnuplot> splot 'C:\Users\raf\Desktop\PolymerProject\monte carlo code\directionInitial.txt' with pm3d
warning: Skipping unreadable file "C:\Users\raf\Desktop\PolymerProject\monte carlo code\directionInitial.txt"
warning: No usable data in this plot to auto-scale axis range
^
All points x value undefined

None of the advice online seems help/solve my problem. New to gnuplot so excuse me if this is obvious.
Please post your code. Attaching your text file might be helpful, as well.
 
This what I enter into the command box:

gnuplot> set pm3d map
gnuplot> splot 'C:\Users\raf\Desktop\PolymerProject\monteCarloCode\directionInitial.txt'

As I said I've tried various different spacings in the .txt file.
 

Attachments

Just as I read my post back I realized I have entered the incorrect path file.
 
rolotomassi said:
This what I enter into the command box:

gnuplot> set pm3d map
gnuplot> splot 'C:\Users\raf\Desktop\PolymerProject\monteCarloCode\directionInitial.txt'

As I said I've tried various different spacings in the .txt file.
I found this documentation -- http://theochem.ki.ku.dk/on_line_docs/gnuplot/gnuplot_36.html
Your data file doesn't seem to match the format used in this example.
A simple example of plotting a 3-d data file is
splot 'datafile.dat'where the file "datafile.dat" might contain:

# The valley of the Gnu.
0 0 10
0 1 10
0 2 10

1 0 10
1 1 5
1 2 10

2 0 10
2 1 1
2 2 10

3 0 10
3 1 0
3 2 10

Note that "datafile.dat" defines a 4 by 3 grid ( 4 rows of 3 points each ). Rows (datablocks) are separated by blank records.

Note also that the x value is held constant within each dataline. If you instead keep y constant, and plot with hidden-line removal enabled, you will find that the surface is drawn 'inside-out'.

Actually for grid data it is not necessary to keep the x values constant within a datablock, nor is it necessary to keep the same sequence of y values. gnuplot requires only that the number of points be the same for each datablock. However since the surface mesh, from which contours are derived, connects sequentially corresponding points, the effect of an irregular grid on a surface plot is unpredictable and should be examined on a case-by-case basis.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
4K
Replies
3
Views
8K
Replies
1
Views
5K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K