I have a 418x284 matrix filled with 0s and 1s and want to plot a graph where the points are all the location of one's and the x and y coordinates are (0 to 284, 0 to -418).
How can I go about doing this?
Thank you for all your help!
How to plot the coordinates of the nonzero elements in a matrix?
935 Views Asked by user2444127 At
2
There are 2 best solutions below
0
Oleg
On
You can also use spy() but you need to adjust the tick labels.
Suppose you have the following matrix:
A = rand(418,284)>.7;
Then:
spy(A)

Adjusting the labels:
yticks = get(gca, 'YTick');
yticks(yticks ~= 0) = -yticks(yticks ~= 0);
set(gca, 'YTickLabel', yticks)

Related Questions in MATLAB
- How to open and read video stream in Matlab
- Interpolation and replace zeroes
- How can I fix my code to do line by line conditional statements in Matlab
- matlab crash during acquisition of pointgrey images
- Calling text file
- Apply gaussian filter on text
- re-plotting of data on same GUI axes in matlab
- Issue with nume1 in MATLAB
- Multiply two variables in Matlab with vpa - high precision
- ODE - Solving Parameter Dependent on Variable [Matlab]
- Need help in detecting multiple blobs
- How does TIC TOC in matlab work?
- Image based steganography that survives resizing?
- lowering computaional cost in finding the location of minimum distance
- FFT Filtering of signal
Related Questions in MATRIX
- Initialize matrix
- Delete a column and a row in a square matrix in C
- multiply each columns of a matrix by a vector
- How can I extract the bounds of a bitmap in a canvas from the values in the transformation matrix?
- Find saddle points in Matlab
- Adding appending numpy arrays
- Python: Array subtract Matrix - TypeError: unsupported operand type(s) for -: 'int' and 'list'
- List of coordinates to matrix of distances
- Is there a way to make array entries complex variables in NumPy?
- Determining regression coefficients for data - MATLAB
- Turning matrix into list of integers as a spiral of given matrix
- Summing multiple columns to equal -1,0,1
- How do I get (LaTeX math) typeset matrix with borders in HTML output from *.Rmd?
- MATLAB Creating a symbolic function with matrix elements
- How to multiply 3 matrices using shared memory in Python?
Related Questions in GRAPH
- Find a MST in O(V+E) Time in a Graph
- Using chart and tooltip
- What clustering algorithms can I consider for graph?
- Clustering on Graph (using Boost Graph Library)
- How to set a domain on an axis and have the axis intervals not constant or take up different amount of interval spaces using d3
- sort graph by distance to end nodes
- Construct and label a uniform graph in NetworkX using dictionaries?
- Plot: Add legend that overlay several Frames
- Labelling nodes in networkx
- Plotting a data frame in R
- How does boost::subgraph work? Can we use filtered graph?
- How do I make a decaying oscilating function in python?
- Deserialize tree given inorder format?
- Having issues with D3 scale and data binding
- ArangoDB graph operations via REST API
Related Questions in PLOT
- Interactive plotting with R raster: values on mouseover
- Octave Real time plotting
- draw the y-label on the top of y axis
- How to use plotyy for 2 different plots inside a subplot?
- MatLab 3-vector plot/mesh with colour-scale
- Display value of Y axis inside GUI plot
- term frequency over time: how to plot +200 graphs in one plot with Python/pandas/matplotlib?
- R: ggplot2: Unable to plot points from a data.frame
- Combine base and ggplot graphics in R figure window in different pages
- Categorical scatter plot in Matlab
- Python3 embedding Matplotlib Plot inside GTK3 using Glade
- Plot: Add legend that overlay several Frames
- R: melting a data.frame to use in ggplot2 for multiple y-value plot
- Matlab: discontinuous plot
- How to plot colors on CIE 1931 Color Space in Matlab?
Related Questions in COORDINATE-SYSTEMS
- The Child SKSpriteKITnodes in the coordinate system doesn't work
- geom_path diameter to scale with coordinate system
- In iOS is it possible to change a View's coordinate system so that 0,0 is top right corner?
- Determine if coordinate is inside region (MKMapView, solve in PHP)
- What is this algorithm mapping coordinates to numbers called?
- Rotation matrix between two spaces
- calculate co-ordinates of lower left corner of minimum enclosing rectangle and length and width provided 2 rectangle
- Postgis - one circles contains another
- Why does my 3 axes system coordinate orientation change x with y values?
- How to convert latitude and longitude in decimal to WGS84 coordinate?
- How to compare two 3d coordinates in python
- ITextSharp using different X & Y axis orientation for different pdf files?
- PBRT toWorld Transformations
- How to calculate camera position/orientation from the picture of a known object?
- How to plot the coordinates of the nonzero elements in a matrix?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Let
matby your binary matrix. You can get the coordinates of the non-zero elements usingfind:Note that the convention for axes is different between images and plots in Matlab. The above code assumes
Iis the rows index (top to bottom) andJis the columns index (left to right).A working example:
Result: