필터 지우기
필터 지우기

How can I create elliptical-shaped markers?

조회 수: 9 (최근 30일)
Noob
Noob 2017년 6월 10일
편집: Karthick SK 2021년 8월 25일
I have two columns of data [X Y] that I would like to plot with elliptical-shaped markers.
  댓글 수: 1
Karthick SK
Karthick SK 2021년 8월 25일
편집: Karthick SK 2021년 8월 25일
In 'Windows' machine it does not work. Select symbols from Matlab default fonts like 'ZapfDingbats' to achieve the goal.
Important thing to note is that you need to give the 'char' command in hexadecimal.
For example,
text(0.5,0.5,char(11055),'fontname','ZapfDingbats','fontsize',20); % char in decimal code
prints the corresponding ZapfDingbats character, whereas
text(0.4,0.5,char(0x2B2C),'fontname','ZapfDingbats','fontsize',20); % char in hexadecimal code
prints the corresponding ZapfDingbats graphic text.
Black Horizontal Ellipse 11052; 0x2B2C;
White Horizontal Ellipse 11053; 0x2B2D;
Black Vertical Ellipse 11054; 0x2B2E;
White Vertical Ellipse 11055; 0x2B2F;
The relevant decimal and hexadecimal values can be found in the following links:
Use the table given in the Unicode blocks for ‘Zapf Dingbats’ .
  1. https://en.wikipedia.org/wiki/Zapf_Dingbats
  2. https://help.adobe.com/en_US/framemaker/2015/using/using-framemaker-2015/Appendix/frm_character_sets_cs/frm_character_sets_cs-5.htm
A detailed code is given below
% sample code to plot letters from a font as markers
clc; clearvars; close all;
% Make some arbitrary data - linear scale
x = linspace(1,10,10);
y = x;
% Use TEXT to plot the character along the data
subplot(121); % linear scale
l = plot(nan, nan); % creating an empty line before
text(x,y,char(11052),'fontname','ZapfDingbats','fontsize',10); % add the actual data
% Manually set axis limits, since TEXT does not do this for you
xlim([min(x)-1 max(x)+1])
ylim([min(y)-1 max(y)+1])
% legend change
l.XData = []; % remove its points from the axes
l.YData = [];
l.Color = [0 0 0]; l.LineStyle = 'none'; l.Marker = 'none';
leg = legend(l,strcat(char(11052),' Data'),'location','northwest');
set(leg,'fontname','ZapfDingbats','fontsize',10);
% finish
axis square; grid on; box on;
(Credits: Kannan Munusamy. My friends found this way as efficient and the credits go to him)

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2017년 6월 10일
See if there is a character that is an ellipse, like in the webdings or wingdings font. Then use text() to place it on your graph.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by