3
A
回答
1
这里是我终于想出了一个代码:它足够灵活的几乎任何应用:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%% Legend Generator %%%%%%%%%%%%%%%%%%%%%
%% NAME : LEGEND_GENERATOR.m
%% FUNCTION : Generates a single plot for arbitrary legend
%% INPUTS : set of markers and related texts as cell and figure number
%% OUTPUTS : No output
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%% AUG 28, 2012 %%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function LEGEND_GENERATOR(Marker,text,Fignum,FONTSIZE,MARKERSIZE,LWD)
% clc;clear;close all;fclose all
% Marker = {'r -*' , 'b -o' , 'g --d'};
% text = {'First Fun ' , 'Second Fun ' , 'Third Fun ' };
% FONTSIZE = 6;
% Fignum = 26;
if length(Marker)~=length(text)
error('You should have the same number of markers as texts');
end
%% FIGURE
set(0,'defaultaxesfontsize',FONTSIZE);
figure(Fignum);clf;hold on;set(gcf,'OuterPosition',[60 90 200 250],'PaperPositionMode','auto');
Leg_TEXTS = [];
for i = 1:length(Marker)
x = 0:0.1:2*pi;
y = 3*randn(1)*sin(x);
p = plot(x,y,Marker{i},'MarkerSize',MARKERSIZE,'LineWidth',LWD);
Leg_TEXTS = [ Leg_TEXTS ; {text{i}} ];
end
legend(Leg_TEXTS);
figure(Fignum);
set([gca;get(gca, 'children')], 'visible', 'off');
end
2
我试图做同样的事情,但我没有成功。我最终做的是从图例中删除一些情节元素。例如:
h = plot(x,y);
hasbehavior(h,'legend', false);
这是另一个example。
0
您可以随时隐藏坐标轴及其所有子:
figure(1), clf, hold on
x = 0:0.1:2*pi;
y = sin(x);
p = plot(x,y);
legend('Sin(x)');
set([gca get(gca, 'children')], 'visible', 'off');
相关问题
- 1. 在地图上绘制标记上的不同字符串
- 2. 带分隔符的标记字符串“/”
- 3. 动态替换字符串中标记的所有实例
- 4. 带有图例标记的jquery事件
- 5. 用UIImageView绘制NSString绘图字符串
- 6. XMLWriter:WriteStartElement带有标记名称和字符串以指示标记名称
- 7. 用带有变量实例号的字符串求和实例
- 8. 排序在python图例手柄和标签的基础上,标签字符串
- 9. 带有标记化字符串的XSL分析字符串难度
- 10. 如何手动绘制Box和Whisker图?
- 11. Matlab图形绘图 - 图例和带标签的曲线
- 12. 表格标记建议,带有长“问题”文字的图例
- 13. 带有标题的图像 - 如何绘制和居中?
- 14. 带有unicode字符串标头的HttpAddRequestHeadersW
- 15. 可拖动标记和绘图工具
- 16. 在标题图像的中心绘制字符串
- 17. 绘制字符串对比图像上
- 18. Openlayers - 在地图上绘制字符串
- 19. 将带有PHP标签的字符串呈现为字符串
- 20. 标记字符串
- 21. 使用slick2d和TTF绘制字符串
- 22. 高绘图后绘制标记点
- 23. 如何绘制这样的“带标记线”图?
- 24. 字符串不会绘制
- 25. 用BitmapFont绘制字符串
- 26. 如何绘制带有标记(分段连接点)的路径?
- 27. Android:计数字符串和绘图
- 28. 如何在手动绘制的控件内绘制手动绘制的控件?
- 29. 手动绘制NSView的子视图
- 30. 比较和绘制字符串的字符?
比你高,这一个人会做这项工作 –