Problem with plot graphics when using MarkerFaceColor in Windows 10

Hi everyone,
I recently started to experience an issue when plotting data using scripts that previously worked well. I believe it might have someting to do with my windows graphics setting rather than Matlab itself but I couldn't find any solution so far. Below I have plotted a generic graph to better explain it. When using 'MarkerFaceColor', instead of having the usual Markers filled by the selected colour they appear irregular and noisy. This problem only shows up when using circles as Markers but not with other symbols and it seems to be independent from the size of the objects, the gca background colour, or the selected MarkerFaceColor.
Below the code that I have use to generate the attached plot.
clearvars; close all; clc;
h=plot([1 2 3],[ 4 2 7],'ko','MarkerSize',12,'MarkerFaceColor','r');
xlim([0 4]); ylim([1 8])

5 件のコメント

dpb
dpb 2022 年 7 月 14 日
Well, that code seemed to have generated the expected result -- what generated the first?
I'd start w/ ensuring your video drivers are up to date -- you can change the 'renderer' setting to software/hardware and see if makes any difference.
W/ that old of a release that worked initially, almost certainly the issue is one that the system has had some updates installed that changed something in the graphics drivers...
Matt086
Matt086 2022 年 7 月 16 日
Hi, thanks for your reply.
The first picture was generated by the very same code on my computer, while the second one was generated on this page by the in-built compiler of MATLAB Answers. My video drivers were already updated to the last version but that didn't affect the final picture.
all the best
Bruno Luong
Bruno Luong 2022 年 7 月 16 日
Can you do this then rerun your code
opengl software
Matt086
Matt086 2022 年 7 月 17 日
Thanks a bunch Bruno!
That solved the issue for me
all the best
dpb
dpb 2022 年 7 月 17 日
Try updating your graphics drivers, then...see which chipset your machine is using.

サインインしてコメントする。

回答 (1 件)

Rishita
Rishita 2022 年 7 月 15 日

0 投票

h = plot(x, y, 'o'); set(h, {'MarkerFaceColor'}, get(h,'Color'));

2 件のコメント

dpb
dpb 2022 年 7 月 15 日
>> x=1:4;y=rand(size(x));
>> h = plot(x, y, 'o'); set(h, {'MarkerFaceColor'}, get(h,'Color'));
Error using matlab.graphics.chart.primitive.Line/set
Invalid parameter/value pair arguments.
>>
???
What was the point of this code snippet towards the OP Q?, @Rishita?
Not sure what you mean with this code, but in the case you were wondering what is the standard 'facecolor' for my markers, that is set to 'none'. If I plot without selecting any colours, I get a normal plot (see example below). This will give me a nice plot with normal (and empty) circles.
However, if later I add something like:
set(h,'markerfacecolor','r');
Then, I'll get the same graph above with weird looking markers, as shown in the original question.
clearvars; close all; clc;
h=plot([1 2 3],[ 4 2 7],'o','MarkerSize',20); xlim([0 4]); ylim([1 8]);
disp(get(h,'markerfacecolor'))
none

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品

リリース

R2017b

質問済み:

2022 年 7 月 14 日

コメント済み:

dpb
2022 年 7 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by