How to prevent the fill command in MATLAB from creating boxes without “corners”

瘦欲@ 提交于 2019-12-07 12:26:54

问题


I am currently using the fill command in MATLAB to create a graph of boxes that were created using the 'fill' command (the actual code is based off this StackOverflow Question.

My issue is that the boxes that I create do not have "corners." I am attaching a PNG that illustrates the issue. Note that you have to look a little carefully since the image was heavily rendered, though in this example my arrows also look weird since they don't have edges either)

I am wondering if anyone has an idea of what might be going wrong? The boxes appear this way immediately after I use the fill command, which has the following structure:

fill(X,Y,MyFaceColor,'FaceAlpha',0.5,'EdgeColor', MyEdgeColor,'LineStyle','','LineWidth',box_line_width,'EdgeAlpha',1)

回答1:


The function fill appears to leave space for corner markers if they are not explicitly defined. Hence, calling fill with the marker property will solve your problem. However, since markers and linewidths seem to work on different scales, you will have to play around with the marker size to get smooth edges.

Example:

fill(X,Y,'r','FaceAlpha',0.5,'EdgeColor', 'k',...
    'LineWidth', 5,'EdgeAlpha',1 , 'marker', '.', 'markersize', 15)


来源:https://stackoverflow.com/questions/17315571/how-to-prevent-the-fill-command-in-matlab-from-creating-boxes-without-corners

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