Mathematica中文论坛-非官方

标题: 豆粑粑 matlab 图中图。 [打印本页]

作者: meatball1982    时间: 2016-8-17 10:27
标题: 豆粑粑 matlab 图中图。


这是在fileexchange里找到的,应该是挺有用的。

  1. % Create data
  2. t = linspace(0,2*pi);
  3. t(1) = eps;
  4. y = sin(t);

  5. % Place axes at (0.1,0.1) with width and height of 0.8
  6. figure
  7. handaxes1 = axes('Position', [0.12 0.12 0.8 0.8]);

  8. % Main plot
  9. plot(t, y)
  10. xlabel('t')
  11. ylabel('sin(t)')
  12. set(handaxes1, 'Box', 'off')

  13. % Adjust XY label font
  14. handxlabel1 = get(gca, 'XLabel');
  15. set(handxlabel1, 'FontSize', 16, 'FontWeight', 'bold')
  16. handylabel1 = get(gca, 'ylabel');
  17. set(handylabel1, 'FontSize', 16, 'FontWeight', 'bold')

  18. % Place second set of axes on same plot
  19. handaxes2 = axes('Position', [0.6 0.6 0.2 0.2]);
  20. fill(t, y.^2, 'g')
  21. set(handaxes2, 'Box', 'off')
  22. xlabel('t')
  23. ylabel('(sin(t))^2')

  24. % Adjust XY label font
  25. set(get(handaxes2, 'XLabel'), 'FontName', 'Times')
  26. set(get(handaxes2, 'YLabel'), 'FontName', 'Times')

  27. % Add another set of axes
  28. handaxes3 = axes('Position', [0.25 0.25 0.2 0.2]);
  29. plot(t, y.^3)
  30. set(handaxes3, 'Box','off')
  31. xlabel('t')
  32. ylabel('(sin(t))^3')
复制代码


fig_in_fig.png (86.79 KB, 下载次数: 966)

fig_in_fig.png





欢迎光临 Mathematica中文论坛-非官方 (http://ilovemathematica.com/) Powered by Discuz! X3.2