Jump to content
Berker

Text Location

Recommended Posts

Hello,

 

In the script below, I created a plot with a simple text on it. 

 

clear all;
close all;
clc;
x=linspace(0,2*pi,200);
y=sin(x);
plot(x,y); hold on;
plot(pi/2,1,'o');
text(pi/2,1,'P1');

 

The axis range of the figure is defined automatically. When I want to plot another function on the same figure, but with a larger axis range, the text that I created initially moves. Please apply the rest of the code below to see it:

 

z=5*cos(x);
plot(x,z,'-r');
plot(pi,-5,'o');
text(pi,-5,'peak');

 

What can I do to prevent the text from moving?

 

Thank you

Berker

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...