How to put degree symbol in x-axis

Dear Experts,
Thanks for your answer in advance! When i draw a x,y plot, in x-axis values says the temperature in degrees. I want to put a degree symbol for each value in x-axis in a plot. How put this degree for each value in the x-axis. Please help me in this regard.
Thank you Raj.

 Accepted Answer

xt=get(gca,'xtick');
for k=1:numel(xt);
xt1{k}=sprintf('%d°',xt(k));
end
set(gca,'xticklabel',xt1);

5 Comments

Dear Azzi Abdelmalek,
It is working fine. This is what i have expected.
Thank you very much for your help. Raj.
You should probably accept Azzi's answer to officially give him the forum credit he deserves ;-)
Hi Azzi and Tobias,
Thanks in advance for your help! I would like to plot a contour of pressure data on a square surface, but the problem is in a square surface there is a hole, that means there is no data at that area, and i have pressure data on the remaining area. I have coordinates where the pressure data available. How can i control this area where the hole is situated? Please help me.
Thanks Raj
Hi Azzi and Tobias, Please have a look at my new question! Please help me in this regard.
I implemented Azzi's solution in a function called degreetick.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!