MATLAB数据:设置线宽和字体大小不能正常工作

时间:2017-02-28 04:00:31

标签: matlab matlab-figure

我正在绘制一些简单的数字并使用LineWidth功能将它们保存到TIFF图像中。但在我保存的图像中,线条很粗,文字非常大。因此,我必须将FontSizeLineWidth设置为一个非常小的值,以确保我的数字看起来很好。现在我将0.05设置为LineWidth。在我看来,72dpi的图像应该是0.05像素宽。但在我的图像中,它似乎是1像素。但是,如果我将1设置为1,我会获得轴边界'宽度约10像素! (我想它应该是1pt * 1 / 72in / pt * 72px / inch = 1px)。我做错了吗?

有一点需要提及:我的图像非常高(324英寸),因为我在一列中有36个子图。

以下是我的代码。请注意,我将轴的边框宽度设置为function [ ] = draw_seq_1( raw_years, year_rng, raw_data, name, datarng ) year_span = year_rng(1):year_rng(end); data = raw_data(:, find(raw_years==year_rng(1)):find(raw_years==year_rng(end))); figure(1); set(gcf, 'Visible', 'off'); base_pos = [0, 0, 18, 6 * size(data,1)]; set(gcf, 'PaperPositionMode', 'manual'); set(gcf, 'unit', 'inches'); set(gcf, 'position', base_pos); set(gcf, 'paperunits', 'inches'); set(gcf, 'paperposition', base_pos); for i = 1:size(data,1) data_to_plot = data(i,:); subplot(size(data,1),1,i); plot(year_span, data_to_plot, 'LineWidth', 0.1, 'Color', [0.4 0.6 0.7]); hold on; plot(year_span, 1+zeros(size(year_span)), 'LineWidth', 0.1, 'Color', [0 0 0]+0.5, 'LineStyle', '--'); title(sprintf('%s(%d-%d) # %d', name, year_rng(1), year_rng(end), datarng(1)+i-1)); set(gca, 'YLim', [0, max(0.1, max(data_to_plot)*1.05)] ); set(gca, 'YTick', [0, 1, 2, 3, 4, 5]); % here set the border width of the axes set(gca, 'LineWidth', 1); set(gca, 'FontSize', 1); set(gca, 'FontUnit', 'points'); end print(gcf, sprintf('%s(%d-%d) # %d-%d.tiff', name, year_rng(1), year_rng(end), datarng(1), datarng(end)), '-dtiff', '-r72'); end

unique_days = np.unique(x.index.date)

我保存的图片如下。您可以看到边框宽度非常粗。enter image description here

0 个答案:

没有答案
相关问题