plot2svg icon indicating copy to clipboard operation
plot2svg copied to clipboard

Scatter not working v R2015a

Open wouterscarl opened this issue 10 years ago • 10 comments

Scatter plots are not working in version R2015a.

wouterscarl avatar Jun 16 '15 16:06 wouterscarl

Can reproduce.

function scatter_test()
%SCATTER_TEST Demonstrates the need for a small patch.

    badMarkerTypes = {'+', '*', 'x', 's', 'd', 'p', 'h', '^', '<', '>'};
    testResults = cellfun(@try_to_convert_scatterplot, badMarkerTypes);
    fprintf(1, '%d out of %d marker types succeeded.\n', sum(testResults), numel(testResults));
end

function success = try_to_convert_scatterplot(markerType)
    testOutputFilename = 'scatter_test.svg';
    h = figure;
    cleanupFigure = onCleanup(@()close(h));
    scatter(1:10, 1:10, markerType);
    cleanupFile = onCleanup(@()close_and_clean_file(testOutputFilename));
    try
        plot2svg(testOutputFilename, h);
    catch exc
        warning('Marker type "%s" failed to convert. Message is "%s"', markerType, exc.message);
        success = 0;
        return;
    end

    success = 1;
end

function close_and_clean_file(filename)
    fclose all;
    delete(filename);
end

ble avatar Oct 14 '15 16:10 ble

I have a fix for this, hang on while I pullrequestify it.

ble avatar Oct 14 '15 16:10 ble

Amazing :-). Will check tomorrow.

Best regards,

Carl Wouters Oil-Free Engineering - Calculations Competence Coach

On 14 Oct 2015 18:49, Ben Ellis [email protected] wrote:

I have a fix for this, hang on while I pullrequestify it.

Reply to this email directly or view it on GitHubhttps://github.com/jschwizer99/plot2svg/issues/6#issuecomment-148113858.

wouterscarl avatar Oct 14 '15 18:10 wouterscarl

Hey Ben,

Any luck on getting it through? :-)

wouterscarl avatar Oct 20 '15 15:10 wouterscarl

I'm not much experienced in the etiquette, but I don't particularly want to repay Juerg's hard work making plot2svg by nagging him...

For the time being, the change is committed to the master branch of my fork ( https://github.com/ble/plot2svg ) and you can get it there.

You can see the diff of the commit here: https://github.com/ble/plot2svg/commit/b6987af8f2adf92a3d3cd7816a5fcfb6e473c982

ble avatar Oct 20 '15 15:10 ble

Since Matlab 2015a it has a build-in svg engine. Just type

saveas(gcf,filename,'svg')

It is by far not as perfect as plot2svg used to be, but at least it can be a start.

kromuchi avatar Dec 15 '15 14:12 kromuchi

Hi,

I've been on this errand with the newer versions of Inkscape and Matlab as well. kromuchi solution unfortunately doesn't work even for slightly sophisticated plots such as mesh surface and 3dplots (the text is embedded on the plot).

averter avatar Jul 23 '16 14:07 averter

Hello. I have the same issue with R2016a: Warning: Unhandled child type: scatter

Pouya-moh avatar Nov 07 '16 12:11 Pouya-moh

Fixed in my fork: https://github.com/kupiqu/plot2svg

kupiqu avatar Jun 20 '18 17:06 kupiqu

just wanted to let you know about the first release of fig2svg which fixes this issue:

https://github.com/kupiqu/fig2svg

kupiqu avatar Nov 26 '18 15:11 kupiqu