Thread Subject: image in axes: making grid visible

Subject: image in axes: making grid visible

From: runcyclexcski@yahoo.com

Date: 22 Aug, 2007 00:36:02

Message: 1 of 10

I display an image in an axes, and I want the grid in the axes and the
tickmarks pointing inwards being visible, i.e. being on top of the
image. But the image always covers up the grid and the tickmarks. Is
there any way to avoid that? I found a workaround by displaying the
tickmarks outward, but with the grid there is no workaround. I looked
in this group and in help and did not find anything. Matlab 6p5, about
to upgrade to R2007.

Subject: image in axes: making grid visible

From: Gautam Vallabha

Date: 22 Aug, 2007 16:29:50

Message: 2 of 10

In article <1187742962.261037.112010@m37g2000prh.googlegroups.com>,
runcyclexcski@yahoo.com says...
> I display an image in an axes, and I want the grid in the axes and the
> tickmarks pointing inwards being visible, i.e. being on top of the
> image. But the image always covers up the grid and the tickmarks. Is
> there any way to avoid that? I found a workaround by displaying the
> tickmarks outward, but with the grid there is no workaround. I looked
> in this group and in help and did not find anything. Matlab 6p5, about
> to upgrade to R2007.

You can try changing the color of the grid and the axis.

----------
 load clown.mat
 figure;
 image(X); colormap(map)

 set(gca,'tickdir','in')
 set(gca,'xcolor','w', 'ycolor', 'w');
 % another way to set the color
 set(gca,'xcolor', [1 1 0], ...
         'ycolor', [1 1 0]);
----------

--
Gautam

Subject: image in axes: making grid visible

From: runcyclexcski@yahoo.com

Date: 22 Aug, 2007 19:30:35

Message: 3 of 10


> You can try changing the color of the grid and the axis.
>
> ----------
> load clown.mat
> figure;
> image(X); colormap(map)
>
> set(gca,'tickdir','in')
> set(gca,'xcolor','w', 'ycolor', 'w');
> % another way to set the color
> set(gca,'xcolor', [1 1 0], ...
> 'ycolor', [1 1 0]);
> ----------

Nope, it did not do anything.

Subject: image in axes: making grid visible

From: runcyclexcski@yahoo.com

Date: 22 Aug, 2007 19:37:35

Message: 4 of 10

... interestingly, it does work with the clown image. But it does not
work with mine.

I load my image like this:

frame_image = image('cdata',myMatrix,'cdatamapping','scaled');

Subject: image in axes: making grid visible

From: Gautam Vallabha

Date: 22 Aug, 2007 20:27:51

Message: 5 of 10

In article <1187811455.531528.178200@j4g2000prf.googlegroups.com>,
runcyclexcski@yahoo.com says...
> ... interestingly, it does work with the clown image. But it does not
> work with mine.
>
> I load my image like this:
>
> frame_image = image('cdata',myMatrix,'cdatamapping','scaled');

Change the 'Layer' property of the axis (This puts the grid
lines on top of the image);
-----------
 load clown.mat;
 image('cdata', X, 'cdatamapping','scaled');
 grid on; axis tight;
 set(gca, 'layer', 'top');
 set(gca, 'xcolor', 'w', 'ycolor', 'w');
-----------

--
Gautam

Subject: image in axes: making grid visible

From: runcyclexcski@yahoo.com

Date: 25 Aug, 2007 03:22:45

Message: 6 of 10

Hey, Gautam, it worked, thanks a bunch!!




Subject: image in axes: making grid visible

From: meha

Date: 31 Oct, 2009 08:40:08

Message: 7 of 10


> I m converting a jpg image into binary using following code:
g=imread('G.jpg');
save g;
load g;
BW = im2bw(g,map,0.4);
imshow(g,map), figure, imshow(BW)

But in ths code, following error is coming:
??? Undefined function or variable 'map'.

How to remove this error?
>
>

Subject: image in axes: making grid visible

From: Steven Lord

Date: 2 Nov, 2009 00:18:34

Message: 8 of 10


"meha " <sign2speech@gmail.com> wrote in message
news:hcgt58$sn9$1@fred.mathworks.com...
>
>> I m converting a jpg image into binary using following code:
> g=imread('G.jpg');
> save g;
> load g;
> BW = im2bw(g,map,0.4);
> imshow(g,map), figure, imshow(BW)
>
> But in ths code, following error is coming:
> ??? Undefined function or variable 'map'.
>
> How to remove this error?

Create the variable map before attempting to use it.

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ

Subject: image in axes: making grid visible

From: ImageAnalyst

Date: 2 Nov, 2009 03:10:26

Message: 9 of 10

What's the point of saving and then loading it? You already have g so
that is unecessary. Your image didn't have a map, so don't use it
subsequently because it's undefined. Just don't use it. Try this:

clc;
close all;
clear all;
workspace; % Show the Workspace panel.

% Read in standard monochrome MATLAB demo image.
grayImage = imread('coins.png');
% Threshold it
binaryImage = im2bw(grayImage, 0.4);

% Display the original image.
subplot(1,2,1);
imshow(grayImage);
title('Original gray scale image');

% Display the thresholded, binary logical image.
subplot(1,2,2);
imshow(binaryImage, []); % Note use of [] to scale it so you can see
it.
title('Thresholded (binary) image');
set(gcf, 'Position', get(0, 'ScreenSize')); % Maximize figure.

Subject: image in axes: making grid visible

From: Make

Date: 2 Nov, 2009 04:08:01

Message: 10 of 10

 runcyclexcski@yahoo.com wrote in message <1187742962.261037.112010@m37g2000prh.googlegroups.com>...
> I display an image in an axes, and I want the grid in the axes and the
> tickmarks pointing inwards being visible, i.e. being on top of the
> image. But the image always covers up the grid and the tickmarks. Is
> there any way to avoid that? I found a workaround by displaying the
> tickmarks outward, but with the grid there is no workaround. I looked
> in this group and in help and did not find anything. Matlab 6p5, about
> to upgrade to R2007.
>
Try like this: if you display an axes in GUI,you can set the property of axes
which called 'visible' 'off'

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
layers First Last 22 Aug, 2007 17:01:52
axes Ned Gulley 21 Aug, 2007 23:44:32
hg Ned Gulley 21 Aug, 2007 23:44:32
image Ned Gulley 21 Aug, 2007 23:44:32
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com