打印断开YTickLabel文本对齐

时间:2016-01-08 00:50:41

标签: matlab plot

我一直试图调整我的matlab图表的yticks。

files = cell(19, 1);
files{1,1} = ['join\_duplicates/freq\_3\_50/gibberish\_detector/dataset.c' ...
            'sv - plus'];
files{2,1} = ['join\_duplicates/freq\_3\_50/gibberish\_detector/join\_sim' ...
            'ilar/dataset.csv - plus'];
files{3,1} = ['join\_duplicates/freq\_3\_50/gibberish\_detector/join\_sim' ...
            'ilar/drop\_fry\_words/dataset.csv - plus'];
files{4,1} = ['join\_duplicates/freq\_3\_50/gibberish\_detector/join\_sim' ...
            'ilar/drop\_fry\_words/bool\_it/dataset.csv - plus'];
files{5,1} = 'join\_duplicates/freq\_3\_70/dataset.csv - plus';
files{6,1} = ['join\_duplicates/freq\_3\_70/gibberish\_detector/dataset.c' ...
            'sv - plus'];
files{7,1} = ['join\_duplicates/freq\_3\_70/gibberish\_detector/join\_sim' ...
            'ilar/dataset.csv - plus'];
files{8,1} = ['join\_duplicates/freq\_3\_70/gibberish\_detector/join\_sim' ...
            'ilar/drop\_fry\_words/dataset.csv - plus'];
files{9,1} = ['join\_duplicates/freq\_3\_70/gibberish\_detector/join\_sim' ...
            'ilar/drop\_fry\_words/bool\_it/dataset.csv - plus'];
files{10,1} = 'join\_duplicates/freq\_8\_50/dataset.csv - plus';
files{11,1} = ['join\_duplicates/freq\_8\_50/gibberish\_detector/dataset.' ...
             'csv - plus'];
files{12,1} = ['join\_duplicates/freq\_8\_50/gibberish\_detector/join\_si' ...
             'milar/dataset.csv - plus'];
files{13,1} = ['join\_duplicates/freq\_8\_50/gibberish\_detector/join\_si' ...
             'milar/drop\_fry\_words/dataset.csv - plus'];
files{14,1} = ['join\_duplicates/freq\_8\_50/gibberish\_detector/join\_si' ...
             'milar/drop\_fry\_words/bool\_it/dataset.csv - plus'];
files{15,1} = 'join\_duplicates/freq\_8\_70/dataset.csv - plus';
files{16,1} = ['join\_duplicates/freq\_8\_70/gibberish\_detector/dataset.' ...
             'csv - plus'];
files{17,1} = ['join\_duplicates/freq\_8\_70/gibberish\_detector/join\_si' ...
             'milar/dataset.csv - plus'];
files{18,1} = ['join\_duplicates/freq\_8\_70/gibberish\_detector/join\_si' ...
             'milar/drop\_fry\_words/dataset.csv - plus'];
files{19,1} = ['join\_duplicates/freq\_8\_70/gibberish\_detector/join\_si' ...
             'milar/drop\_fry\_words/bool\_it/dataset.csv - plus'];

 y = ...
  [0.22735643734442865 0.33654308346229661 0.51184196030082607 0.9;
   0.22959000546470559 0.32925282093626884 0.50996585509481518 0.875;
   0.246700394228092 0.3234473708658489 0.51063964237715587 0.875;
   0.097964229750337764 0.38874576802873467 0.49164311195976124 0.6125;
   0.22930374445823762 0.33699921704209623 0.51232709520159625 0.9;
   0.22735643734442865 0.33654308346229661 0.51184196030082607 0.9;
   0.22959000546470559 0.32925282093626884 0.50996585509481518 0.875;
   0.246700394228092 0.3234473708658489 0.51063964237715587 0.875;
   0.097964229750337764 0.38874576802873467 0.49164311195976124 0.6125;
   0.22930374445823762 0.33699921704209623 0.51232709520159614 0.9;
   0.22735643734442865 0.33654308346229661 0.51184196030082607 0.9;
   0.22959000546470559 0.32925282093626884 0.50996585509481518 0.875;
   0.246700394228092 0.3234473708658489 0.51063964237715587 0.875;
   0.097964229750337764 0.38874576802873467 0.49164311195976124 0.6125;
   0.22930374445823762 0.33699921704209623 0.51232709520159614 0.9;
   0.22735643734442865 0.33654308346229661 0.51184196030082607 0.9;
   0.22959000546470559 0.32925282093626884 0.50996585509481518 0.875;
   0.246700394228092 0.3234473708658489 0.51063964237715587 0.875;
   0.097964229750337764 0.38874576802873467 0.49164311195976135 0.6125];

figure('visible', 'off', 'PaperType', 'a4', 'PaperOrientation', 'portrait', ...
  'PaperUnits', 'centimeters', 'PaperPosition', [0 0 21 29.7], 'PaperPositionMode', 'manual', ...
  'Menubar', 'none', 'defaulttextinterpreter', 'latex', 'units', 'normalized', 'outerposition', [0 0 1 1]);
hold on

title('title')

set(gca, 'YTick', 1:19, 'YTickLabel', files)
set(gca, 'FontSize', 5)
ax = gca;
ax.Title.FontSize = 10;

barh(y)
print('res.pdf', '-dpdf', '-r0')

打印结果:

Result with print

结果与数字 - >另存为

enter image description here

我的问题是:为什么yticks标签的文字理由与print()不正确对齐

0 个答案:

没有答案