Skip to content

Scaling factors of exponentially scaled ticks not visible [possible solution included] #11

@kromuchi

Description

@kromuchi

Using Matlab 2013b.

Scaling factors of exponentially scaled ticks are not printed in the current version.

figure;plot([1 2],[0.00001 0.00002]); 
plot2svg;

plot2svg_old

This is caused by a NaN-result of the call str2double(numlabels). However, a small fix in the function exponent2svg can solve the issue: Replacing

if ~isempty(numlabels)
    numlabels = str2double(numlabels);  
end

with

if ~isempty(numlabels)
    numlabels_tmp = str2double(numlabels);
    if(isnan(numlabels_tmp)) || size(numlabels,1) ~= size(numlabels_tmp,1)
        numlabels = str2num(numlabels);
    else
        numlabels = numlabels_tmp;
    end
end

tree times (for XTickLabel, YTickLabel and ZTickLabel) produces a correct figure. Maybe numlabels = str2double(numlabels); can simply be replaced by numlabels = str2num(numlabels); but I don't know the benefits of str2double and before breaking other things (e.g. in newer Matlab versions), the solution provided above should be safe.

plot2svg_fixed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions