4

Hi I have a image in MATLAB

enter image description here

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

enter image description here

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?

bla
  • 25,846
  • 10
  • 70
  • 101
Caslav
  • 487
  • 1
  • 5
  • 15
  • I don't see how your code smooths markers. I think it only smooths the lines in the first three plot lines. The plot lines where you plot the markers (the second three) do not have their LineSmoothing properties set. – HebeleHododo Jan 22 '13 at 11:16

2 Answers2

4

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

bla
  • 25,846
  • 10
  • 70
  • 101
3

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

Community
  • 1
  • 1
xenoclast
  • 1,635
  • 15
  • 26
  • because it still smoothed the markers in the second command or because I didn't get the syntax right? Try swapping the lines around so it draws the markers first and the smoothed lines second. Also try each one separately to make sure I got the syntax right - it might be that the first one draws markers anyway and you have to explicitly tell it not to : ) – xenoclast Jan 22 '13 at 11:28
  • I tired switching order, deactivateing smooth where matlab plots markers and always smoothes all the picture. Export_fig from the answer above works great!! – Caslav Jan 22 '13 at 12:05