MATLAB R2014b Graphics --> How to get thin lines (grid, curves, box,...)

조회 수: 2 (최근 30일)
Samir
Samir 2015년 1월 15일
편집: Debarupa Som 2019년 7월 20일
Hello, I started to use the new graphics (2014b) and I see quite some interesting things.
However, I am disappointed to see that one of the most interesting aspects of the MATLAB graphs is gone :( To be clear, I was very happy with the graphs having very thin lines (box, curves,...). It gave a very sophisticated look. Now, even when I try to force the thickness of the lines and the box to very low values, I still get an ugly thick box and lines :( The very thin grid lines I used to have are now very rough and thick... Unless I am doing something wrong ? Any solution for that ?
I raised the question in November 17th of last year without any answer so far: http://blogs.mathworks.com/loren/2014/10/14/matlab-r2014b-graphics-part-2-using-graphics-objects/#comment-44544
Please look at the code below. Executed in 2014a or 2014b gives a huge difference in the precision and look of the graphs. Thanks a lot.
if true
% Example of code
x=1:10;
plot(x,x.*x,'-o','Color', 'r','MarkerFaceColor',[1,0.69,0.39],'LineWidth',0.01);
set(gcf, 'Units', 'centimeters');
afFigurePosition = [0.1 18 10 7]; % [pos_x pos_y width_x width_y]
set(gcf, 'Position', afFigurePosition);
set(gcf, 'PaperPositionMode', 'auto');
grid on;
set(gcf, 'Renderer', 'painters');
resol='300';
print('-dmeta', ['-r' resol], '-painters', ['ExamplCurve_' resol '.emf']);
end
  댓글 수: 2
Oliver Woodford
Oliver Woodford 2015년 2월 16일
Further references to this issue here: https://github.com/altmany/export_fig/issues/31
Md Zillur Rahman
Md Zillur Rahman 2015년 10월 15일
you can solve this issue by using
GridAlpha — Grid-line transparency 0.15 (default) | value in the range [0,1] Grid-line transparency, specified as a value in the range [0,1]. A value of 1 means opaque and a value of 0 means completely transparent.
Setting this property sets the associated mode property to manual.
Example: ax.GridAlpha = 0.5

댓글을 달려면 로그인하십시오.

답변 (3개)

Seth Kosowsky
Seth Kosowsky 2016년 2월 11일
I had a similar problem with gridlines, and I found the problem is that when matlab renders into meta, it renders the grid lines as lines, iff the gridalpha properties are = 1.0. If gridalpha values are < 1 (default), then it renders the gridlines as rectangle objects. These objects become thick lined things in, say, powerpoint when you 'ungroup' the object. So, for example for the grid lines, set(gca, 'gridalpha', 1) and set(gca, 'minorgridalpha', 1) solves it. (well it did for me). Good luck.
  댓글 수: 3
Mike Garrity
Mike Garrity 2016년 2월 12일
As Yair said in that other thread, there was a fix for the minimum line width bug in R2015b. Have you tried that version?
Samir
Samir 2016년 2월 24일
Hi Mike, Yes I did try this version. Unfortunately, the lines behave strange: the thickness and darkness of the lines is not uniform over the full graph (parts of the graph have thick and dark lines and other parts show thin to invisible lines). :(

댓글을 달려면 로그인하십시오.


Saurabh Harsh
Saurabh Harsh 2015년 2월 13일
Axes have a property named GridLineStyle which can be modified to get desired grid line style. There is also the property LineWidth for Axes which controls Width of axes outline, tick marks and grid lines together. These properties and more can be found in the following doc page:
  댓글 수: 1
Image Analyst
Image Analyst 2015년 2월 16일
Samir's "Answer" moved here:
*Hi, As you can see, I used (in my example given above) the "LineWidth" property and it does not help. Something has changed in 2014b that make the lines by default thick and does not allow to thin them down. :(*

댓글을 달려면 로그인하십시오.


Alex
Alex 2015년 3월 31일
Have you tried changing the figure parameter GraphicsSmoothing?
set(gcf,'GraphicsSmoothing','off')
  댓글 수: 2
Samir
Samir 2015년 3월 31일
This is not helping :(
Debarupa Som
Debarupa Som 2019년 7월 20일
편집: Debarupa Som 2019년 7월 20일
I am having similar problems. Also while copying and pasting the figures in word, some of the grid lines are missing. Tried gridalpha, line width and graphic smoothing but it is not getting any better.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by