Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
add line object in contour plot

Subject: add line object in contour plot

From: edward kabanyas

Date: 17 Aug, 2011 07:36:09

Message: 1 of 3

Hi all !,

I want to add line object in my contour plot. I try the following code:

levels=0.0:0.1:2.1;
[cs,cs]=contourf(lon,idate,data_p, levels);
set(cs,'edgecolor','none');

% add the line
hold on
for i=1:1: length(yre)
line([Lonend(i) DateNumberbG(i)],[Lonbegin(i) DateNumberEn(i)],'LineStyle','-', 'LineWidth',2)
hold on
end

firstDays = datenum(2004,4,1:30,0:21,0,0);
% Update the tick locations
set(gca, 'YTick', firstDays);

datetick('y','yyyymmdd','keepticks');
%set(gca,'YTick',[y(1):1:y(end)])
set(gca, 'YDir', 'reverse')
%set(gca,'CLim',[0 2.1]);
colormap(jet(23));
colorbar('location','northoutside')
xlim([90 150])
xlabel('Longitude'); ylabel('Date');

% Make sure the axes spans the entire year
ylim(idate([1 end]))
hold off


When I execute this code, there is no visible error, but I can not see the plotted line in my plot. Could you suggest any solution ?

Thanks for help

EDward

Subject: add line object in contour plot

From: Steven_Lord

Date: 17 Aug, 2011 16:16:43

Message: 2 of 3



"edward kabanyas" <djuky_hmi@yahoo.com> wrote in message
news:j2fr19$2q9$1@newscl01ah.mathworks.com...
> Hi all !,
>
> I want to add line object in my contour plot. I try the following code:

*snip*

> When I execute this code, there is no visible error, but I can not see the
> plotted line in my plot. Could you suggest any solution ?

You haven't given any Z coordinates in your call to LINE, so it's being
drawn in the XY plane (where Z = 0.) If contour plot patches are drawn for a
higher level of Z, then they will cover the lines you created.

This is just a guess, though, since you didn't provide any sample data with
which the group could execute your code.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: add line object in contour plot

From: edward kabanyas

Date: 18 Aug, 2011 00:40:10

Message: 3 of 3

Hi Steven;

Thanks for suggestion. It works, by setting the value of Z.

Edward

"Steven_Lord" <slord@mathworks.com> wrote in message <j2gpha$9vk$1@newscl01ah.mathworks.com>...
>
>
> "edward kabanyas" <djuky_hmi@yahoo.com> wrote in message
> news:j2fr19$2q9$1@newscl01ah.mathworks.com...
> > Hi all !,
> >
> > I want to add line object in my contour plot. I try the following code:
>
> *snip*
>
> > When I execute this code, there is no visible error, but I can not see the
> > plotted line in my plot. Could you suggest any solution ?
>
> You haven't given any Z coordinates in your call to LINE, so it's being
> drawn in the XY plane (where Z = 0.) If contour plot patches are drawn for a
> higher level of Z, then they will cover the lines you created.
>
> This is just a guess, though, since you didn't provide any sample data with
> which the group could execute your code.
>
> --
> Steve Lord
> slord@mathworks.com
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

Tags for this Thread

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.

Contact us