How to mirror a plot in x and y axis.
109 次查看(过去 30 天)
显示 更早的评论
I want to mirror a plot in x and y axis so i forms a symmetrical shape made of four of the same randomly generated polygon.
prompt = {'Enter Number of vertices:',}
numberOfVertices = str2num(cell2mat(inputdlg(prompt, 'enter a number', 5)))
%numberOfVertices = 7; % Fixed at 7 for this demo.
coordinates = rand(numberOfVertices, 2);
coordinates(1,:) = [0, 0]; % Force first coord to 0,0
coordinates(end+1,:) = [0, 0]; % Force last coord to 0,0
plot(coordinates(:,1), coordinates(:,2));
grid on;
randomColor = rand(1,3);
patch(coordinates(:,1), coordinates(:,2), randomColor); % Can use fill() also.
set(gca, 'xdir', 'reverse');
grid on;
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!