Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Legend font size with painters does not preserve box

Subject: Legend font size with painters does not preserve box

From: Misha Koshelev

Date: 28 Jul, 2009 22:31:02

Message: 1 of 2

Legend goes outside box when saving as PDF:

http://people.hnl.bcm.edu/misha/temp.pdf

Any good fixes for this?

Thank you
Misha

---

p.s. Here is code to generate. Thank you

    % New figure with specified font size
    fig = figure('visible', 'on', 'paperorientation', 'landscape');
    set(gca, 'fontsize', voxels.plot.fontsize);
    
    % Plot
    errorbar(...
        repmat(voxels.plot.idx_timepoints(:),1,length(voxels.plot.idx_region)),...
        plot_mean', ...
        plot_sem', ...
        'LineWidth', voxels.plot.linewidth);

    % Center event at time point 0
    vline(0,'k', ...
          sprintf('%s for %s\n%s for %s', ...
                  voxels.stats.event_center{voxels.ROLE_INDEX+voxels.INVESTOR},...
                  voxels.ROLE_STRING_PLURAL{voxels.ROLE_INDEX+voxels.INVESTOR},...
                  voxels.stats.event_center{voxels.ROLE_INDEX+voxels.TRUSTEE},...
                  voxels.ROLE_STRING_PLURAL{voxels.ROLE_INDEX+voxels.TRUSTEE}));
    
    % Labels
    xlim(voxels.stats.time_center);
    xlabel('time (secs)');
    
    our_ylabel = '% change in MR signal';
    switch voxels.plot.idx_normalize
      case voxels.detrend.NORMALIZE_MEAN
        our_ylabel = [our_ylabel ...
                      sprintf('\nnormalized to image-wise mean voxel value')];
      case voxels.detrend.NORMALIZE_GLOB
        our_ylabel = [our_ylabel ...
                      sprintf('\nnormalized to image-wise mean voxel value\nafter dropping voxels <1/8th of overall image mean')];
      case voxels.detrend.NORMALIZE_REGION
        our_ylabel = [our_ylabel ...
                       sprintf('\nafter subtraction of mean voxel value\nfrom region %s', ...
                               voxels.region(voxels.detrend.idx_region).name)];
    end
    ylabel(our_ylabel, 'interpreter', 'none');
    
    title([our_subject ...
           sprintf(' from\n') ...
           our_source]);
    
    legend(voxels.plot.region_name, 'Location', 'SouthOutside', 'interpreter', 'none');

    if isfield(voxels.plot, 'output_pdf') && ...
            voxels.plot.output_pdf == 1
        set(gcf, 'papertype', 'usletter', 'paperorientation', ...
                 'landscape', 'paperunits', 'normalized', ...
                 'paperposition', [0 0 1 1]);
        name = voxels.output_file.name_plot;
        if voxels.plot.output_pdf_timedate
            name = [name '-' datestr(now(), 'mm.dd.yy-HH.MM.SS')];
        end
        name = [name '.pdf'];
        print(fig, '-painters', '-dpdf', name);
    end
    

Subject: Legend font size with painters does not preserve box

From: Misha Koshelev

Date: 28 Jul, 2009 22:49:01

Message: 2 of 2

For that matter the legend box overlies the x axis label too. I think same problem. Any ideas?

Thank you
MIsha

"Misha Koshelev" <mk144210@bcm.edu> wrote in message <h4nu76$bvv$1@fred.mathworks.com>...
> Legend goes outside box when saving as PDF:
>
> http://people.hnl.bcm.edu/misha/temp.pdf
>
> Any good fixes for this?
>
> Thank you
> Misha
>
> ---
>
> p.s. Here is code to generate. Thank you
>
> % New figure with specified font size
> fig = figure('visible', 'on', 'paperorientation', 'landscape');
> set(gca, 'fontsize', voxels.plot.fontsize);
>
> % Plot
> errorbar(...
> repmat(voxels.plot.idx_timepoints(:),1,length(voxels.plot.idx_region)),...
> plot_mean', ...
> plot_sem', ...
> 'LineWidth', voxels.plot.linewidth);
>
> % Center event at time point 0
> vline(0,'k', ...
> sprintf('%s for %s\n%s for %s', ...
> voxels.stats.event_center{voxels.ROLE_INDEX+voxels.INVESTOR},...
> voxels.ROLE_STRING_PLURAL{voxels.ROLE_INDEX+voxels.INVESTOR},...
> voxels.stats.event_center{voxels.ROLE_INDEX+voxels.TRUSTEE},...
> voxels.ROLE_STRING_PLURAL{voxels.ROLE_INDEX+voxels.TRUSTEE}));
>
> % Labels
> xlim(voxels.stats.time_center);
> xlabel('time (secs)');
>
> our_ylabel = '% change in MR signal';
> switch voxels.plot.idx_normalize
> case voxels.detrend.NORMALIZE_MEAN
> our_ylabel = [our_ylabel ...
> sprintf('\nnormalized to image-wise mean voxel value')];
> case voxels.detrend.NORMALIZE_GLOB
> our_ylabel = [our_ylabel ...
> sprintf('\nnormalized to image-wise mean voxel value\nafter dropping voxels <1/8th of overall image mean')];
> case voxels.detrend.NORMALIZE_REGION
> our_ylabel = [our_ylabel ...
> sprintf('\nafter subtraction of mean voxel value\nfrom region %s', ...
> voxels.region(voxels.detrend.idx_region).name)];
> end
> ylabel(our_ylabel, 'interpreter', 'none');
>
> title([our_subject ...
> sprintf(' from\n') ...
> our_source]);
>
> legend(voxels.plot.region_name, 'Location', 'SouthOutside', 'interpreter', 'none');
>
> if isfield(voxels.plot, 'output_pdf') && ...
> voxels.plot.output_pdf == 1
> set(gcf, 'papertype', 'usletter', 'paperorientation', ...
> 'landscape', 'paperunits', 'normalized', ...
> 'paperposition', [0 0 1 1]);
> name = voxels.output_file.name_plot;
> if voxels.plot.output_pdf_timedate
> name = [name '-' datestr(now(), 'mm.dd.yy-HH.MM.SS')];
> end
> name = [name '.pdf'];
> print(fig, '-painters', '-dpdf', name);
> end
>

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us