Custom Markers for Matlab Charts

I searched google and everyone says it is not supported. I was wondering if there are any public mclab community features that could build a custom png as a marker. The closest I found is http://de.mathworks.com/matlabcentral/fileexchange/39487-custom-marker-plot/content/plotCustMark/plotCustMark.m . But this does not meet the intended purpose. Let me know if it’s even possible for me to write something for this! Thank.

An additional problem . Ok, now I have this strange problem. my png has a black background !! I do not understand why. I tried to lower the alpha value, still not working.

Solution . The problems that I mentioned in the comments on @brainkz can be resolved with

http://de.mathworks.com/matlabcentral/answers/144411-displaying-image-over-background-making-top-image-background-color-transparent

Method : import image transparency settings through

[marker,map,transperancy ] = imread('car.png');

and then install

handleIm = imagesc([x_low x_high], [y_low y_high], marker)
set(handleIm ,'AlphaData',transperancy);

Clarification . All images were transparent, but since I overlaid them on top of another image, it turned the current background of the image into black by default. I posted a solution to this problem that I think would be very useful for many people.

+4
source share
1 answer

imagesccan put png on your plot. We can use it as follows:

:

x = 1:10;
y = 5*rand(size(x)) + 2.5;

:

marker = imread('icon.png');

x y:

markersize = [1,1]; %//The size of marker is expressed in axis units, NOT in pixels
x_low = x - markersize(1)/2; %//Left edge of marker
x_high = x + markersize(1)/2;%//Right edge of marker
y_low = y - markersize(2)/2; %//Bottom edge of marker
y_high = y + markersize(2)/2;%//Top edge of marker

for k = 1:length(x)
    imagesc([x_low(k) x_high(k)], [y_low(k) y_high(k)], marker)
    hold on
end
axis equal
hold off

, , :

enter image description here

, .

,

+9

Source: https://habr.com/ru/post/1650134/


All Articles