# How can I create elliptical-shaped markers?

21 views (last 30 days)
Noob on 10 Jun 2017
Edited: Karthick SK on 25 Aug 2021
I have two columns of data [X Y] that I would like to plot with elliptical-shaped markers.
Karthick SK on 25 Aug 2021
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’ .
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 on 10 Jun 2017
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.
Walter Roberson on 10 Jun 2017