Error Saving Figure in `saveplotlyfig` in MATLAB R2024b
RoyiAvital opened this issue · 6 comments
RoyiAvital commented
In saveplotlyfig the following will fail:
elseif ishandle(figure_or_data)
if strcmp(handle(figure_or_data).classhandle.name,'figure')
p = plotlyfig(figure_or_data, 'strip', false);As handle(figure_or_data).classhandle will generate nrecognized method, property, or field 'classhandle' for class 'matlab.ui.Figure'..
RoyiAvital commented
Currently I edited:
function p = saveplotlyfig(figure_or_data, filename, varargin)
%--PARSE FIGURE_OR_DATA--%
if iscell(figure_or_data)
p = plotlyfig('Visible','off');
p.data = figure_or_data;
p.layout = struct();
p.PlotOptions.Strip = false;
elseif isstruct(figure_or_data);
p = plotlyfig('Visible','off');
p.data = figure_or_data.data;
p.layout = figure_or_data.layout;
p.PlotOptions.Strip = false;
elseif isa(figure_or_data, 'plotlyfig')
p = figure_or_data;
p.PlotOptions.Strip = false;
elseif ishandle(figure_or_data)
% if strcmp(handle(figure_or_data).classhandle.name,'figure')
%----Royi----%
if strcmp(get(figure_or_data, 'type'), 'figure')
%----Royi----%
p = plotlyfig(figure_or_data, 'strip', false);
end
else
errkey = 'plotlySaveImage:invalidInputs';
error(errkey,plotlymsg(errkey));
end
%--MAKE CALL TO SAVEAS METHOD--%
p.saveas(filename, varargin{:});
end
RoyiAvital commented
OK, Even after the fix I can't save the figure.
robertoffmoura commented
Hi, could you please share some steps to reproduce this issue? E.g. a minimal reproducible example or a detailed description of the actions leading to the issue. This will help investigate the problem more effectively. Thanks!
RoyiAvital commented
Nothing special. Just using the latest version of PlotLy with MATLAB R2024b.
robertoffmoura commented
Do you have a script to generate the plot you're trying to save with saveplotlyfig?