Home Marker face colour different in plot from that specified in Matlab command
Reply: 0

Marker face colour different in plot from that specified in Matlab command

user1469
1#
user1469 Published in May 27, 2018, 3:37 am

With the following code (simplified to a minimal working example), I am trying to create 4 subplots (scatterplots with marginal histograms), and I'd like the markers in each subplot to have different colors. However, to my surprise, there is always a small difference from the actual color requested. For instance, in the first case, rather than red (255,0,0), I could ascertain that my markers are a slightly different colour (255, 102, 102).

I tried debugging this in various ways but cannot figure out why this occurs. Can anyone help? I am using Matlab 2016B, on Windows 10, and have up to date graphics drivers installed. Thanks in advance!

for i_genre=1:N_genre
    switch i_genre
        case 1 
            h1 = figure;
            markerColour_genrewise = 'red';
        case 2 
            h2 = figure;
            markerColour_genrewise = 'blue';
        case 3 
            h3 = figure;
            markerColour_genrewise = 'black';
        case 4 
            h4 = figure;
            markerColour_genrewise = 'white';
    end
    x = GMSI;
    y = ratingsDiffs_avgAcrossExemplars(:, i_genre)';
    h = scatterhist(x, y, 'NBins', [nbinsX nbinsY], 'MarkerSize', markerSize, 'Color', markerColour_genrewise);
    set(gca,'linewidth', lineWidth, 'FontName', fontName)
    mygca = get(gca,'children'); set(mygca,'markerfacecolor',markerColour_genrewise);
        % irrelevant code followed here, deleted
end
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.467261 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO