Anti-alias lines vs markers in MATLAB

一笑奈何 提交于 2019-12-10 15:56:16

问题


Hi I have a image in MATLAB

and I want the line to be smooth - look at the line from 0.4 to 0.8... it's horrible. When using 'LineSmoothing','on' operator in plot I get this

I does a good job on lines but it smooths markers also and they are horrible!!

How can I get MATLAB to smooth only lines and not the markers??

Here is the code:

clear all;
close all;

bpp = [0.8 0.4 0.2 0.1 0.05];
bpp_j = [0.8 0.4 0.2 0.1];
AAE_JPEG = [1.65 2.91 6.20 10.96];
AAE_JPEG_2000 = [1.39 2.29 3.78 6.75 12.52];
AAE_EEDC = [2.08 2.67 3.80 5.94 9.31];
hold on;
plot(bpp_j, AAE_JPEG, 'k','LineWidth',1.5,'MarkerSize',9,'MarkerEdgeColor','k','LineSmoothing','on');
plot(bpp, AAE_JPEG_2000, 'k', 'LineWidth',1.5,'MarkerSize',6,'MarkerEdgeColor','k','LineSmoothing','on');
plot(bpp, AAE_EEDC, 'k', 'LineWidth',1.5,'MarkerSize',6,'MarkerEdgeColor','k','LineSmoothing','on');

plot(bpp_j, AAE_JPEG, 'x','LineWidth',1.5,'MarkerSize',8,'MarkerEdgeColor','k');
plot(bpp, AAE_JPEG_2000, 'o', 'LineWidth',1.5,'MarkerSize',6,'MarkerEdgeColor','k');
plot(bpp, AAE_EEDC, 'v', 'LineWidth',1.5,'MarkerSize',6,'MarkerEdgeColor','k');

LL = plot(rand(1,2),rand(1,2),'k-x','visible','off','LineWidth',1.5,'MarkerSize',8);
LK = plot(rand(1,2),rand(1,2),'k-o','visible','off','LineWidth',1.5,'MarkerSize',6);
LI = plot(rand(1,2),rand(1,2),'k-v','visible','off','LineWidth',1.5,'MarkerSize',6);
legend([LL,LK, LI],'JPEG','JPEG 2000','EEDC')


axis([0 0.9 0 14])
xlabel('bpp');
ylabel('AAE');
grid on;

and while I'm still here... how can I only display 0.05 0.1 0.2 0.4 and 0.8 on x-axis?


回答1:


I'd just try using export_fig without even linesmoothing the lines...




回答2:


I don't have a MATLAB here so I can't test but does it work if you plot the smoothed lines without markers

plot(bpp_j, AAE_JPEG, 'k','LineWidth',1.5,'LineSmoothing','on');

then another plot of the markers with no lines?

plot(bpp_j, AAE_JPEG, 'x','MarkerSize',8,'MarkerEdgeColor','k');

As for the x-axis ticks see matlab x axis label set as a vector



来源:https://stackoverflow.com/questions/14456460/anti-alias-lines-vs-markers-in-matlab

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!