How can I create elliptical-shaped markers?

10 Ansichten (letzte 30 Tage)
Noob
Noob am 10 Jun. 2017
Bearbeitet: Karthick SK am 25 Aug. 2021
I have two columns of data [X Y] that I would like to plot with elliptical-shaped markers.
  1 Kommentar
Karthick SK
Karthick SK am 25 Aug. 2021
Bearbeitet: Karthick SK am 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’ .
  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)

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Image Analyst
Image Analyst am 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.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by