Plotly 2d轴/线强加于3d Plot

时间:2017-03-03 16:15:16

标签: matlab plotly

我在剧情论坛上问了这个问题,但是没人能帮忙,所以我想我会在这里问。

我正在尝试使用fig2plotly将3d MATLAB绘图转换为离线绘图。我有一个看起来正确的3D MATLAB图,并且在这个MATLAB图中有一个线对象。每当我将它转换为绘图时,线对象就会消失,但是在3d绘图上会出现一个二维轴和一条线(如果我解释那么糟糕,下面的图片)

我想知道为什么这样做或者如果有人有任何他们可以分享的东西。如果我只是从MATLAB中删除线对象,我可以删除2d轴/红线,但实际上我需要在中心的线对象。

MATLAB Plot:

MATLAB Plot

Plotly Plot: Plotly Plot

谢谢你的帮助!

编辑以添加代码: 在此之前的大部分代码只是设置不同的变量。如果我应该加上这个,请告诉我。

   surf(MDsub3, X_Lsub3, Y_Hsub3, maxDiameterAtDepth * ones(size(MDsub3)), 'lineStyle', 'none', 'Marker', 'none')
        alpha(0.7);
        cm = jet(256);
        colormap(flipud(cm));
        caxis([0 casingdiam_inch]);
        colorbar;
        MDsub4 = MDsub3(:, 1 : 2 : end);
        X_Lsub4 = X_Lsub3(:, 1 : 2 : end);
        Y_Hsub4 = Y_Hsub3(:, 1 : 2 : end);
        line(MDsub4, X_Lsub4, Y_Hsub4, 'Color', 'k');
        MDsub5 = MDsub3(1 : 2 : end, :);
        X_Lsub5 = X_Lsub3(1 : 2 : end, :);
        Y_Hsub5 = Y_Hsub3(1 : 2 : end, :);
        line(MDsub5', X_Lsub5', Y_Hsub5', 'Color', 'k');

        %----->This line seems to cause the 2d axis / red line on the plotly graph. Need this line for the line object in the center of the matlab graph.%
       line(MDsub, zeros(1, length(MDsub)), zeros(1, length(MDsub)), 'Color', 'k', 'LineWidth', 3)

        xlab_MD = sprintf('MD [%s]', depthUnit);
        xlab_L = sprintf('Lateral [inches]');
        xlabel(xlab_MD, 'FontSize', 14)
        ylabel(xlab_L, 'FontSize', 14);
        titleString = sprintf(TITLE WAS HERE);
        title(titleString, 'FontSize', 14);
        zlabelString = sprintf('High Side [inches]');
        zlabel(zlabelString, 'FontSize', 14);
        set(gca, 'DataAspectRatio', aspectRatio);
        set(gca, 'FontSize', 14);
        fileName = strcat(job,'plot');
        fp = fig2plotly(fig,'offline',true,'filename',fileName,'strip',true);
        fp.data{1}.cmin = 0;
        fp.data{1}.cmax = casingdiam_inch;
        fp.data{1}.opacity = 0.99;
        fp.data{1}.surfacecolor = maxDiameterAtDepth * ones(size(MDsub3));
        fp.data{1}.reversescale = true;
        fp.data{1}.colorscale = {{0,'rgb(0,0,140)'},{0.015625, 'rgb(0,0,143.4375)'},{0.03125, 'rgb(0,0,159.375)'},{0.046875, 'rgb(0,0,175.3125)'},{0.0625, 'rgb(0,0,191.25)'},{0.078125, 'rgb(0,0,207.1875)'},{0.09375, 'rgb(0,0,223.125)'},{0.109375, 'rgb(0,0,239.0625)'},{0.125, 'rgb(0,0,255)'},{0.140625, 'rgb(0,15.9375,255)'},{0.15625, 'rgb(0,31.875,255)'},{0.171875, 'rgb(0,47.8125,255)'},{0.1875, 'rgb(0,63.75,255)'},{0.203125, 'rgb(0,79.6875,255)'},{0.21875, 'rgb(0,95.625,255)'},{0.234375, 'rgb(0,111.5625,255)'},{0.25, 'rgb(0,127.5,255)'},{0.265625, 'rgb(0,143.4375,255)'},{0.28125, 'rgb(0,159.375,255)'},{0.296875, 'rgb(0,175.3125,255)'},{0.3125, 'rgb(0,191.25,255)'},{0.328125, 'rgb(0,207.1875,255)'},{0.34375, 'rgb(0,223.125,255)'},{0.359375, 'rgb(0,239.0625,255)'},{0.375, 'rgb(0,255,255)'},{0.390625, 'rgb(15.9375,255,239.0625)'},{0.40625, 'rgb(31.875,255,223.125)'},{0.421875, 'rgb(47.8125,255,207.1875)'},{0.4375, 'rgb(63.75,255,191.25)'},{0.453125, 'rgb(79.6875,255,175.3125)'},{0.46875, 'rgb(95.625,255,159.375)'},{0.484375, 'rgb(111.5625,255,143.4375)'},{0.5, 'rgb(127.5,255,127.5)'},{0.515625, 'rgb(143.4375,255,111.5625)'},{0.53125, 'rgb(159.375,255,95.625)'},{0.546875, 'rgb(175.3125,255,79.6875)'},{0.5625, 'rgb(191.25,255,63.75)'},{0.578125, 'rgb(207.1875,255,47.8125)'},{0.59375, 'rgb(223.125,255,31.875)'},{0.609375, 'rgb(239.0625,255,15.9375)'},{0.625, 'rgb(255,255,0)'},{0.640625, 'rgb(255,239.0625,0)'},{0.65625, 'rgb(255,223.125,0)'},{0.671875, 'rgb(255,232.6875,0)'},{0.6875, 'rgb(255,191.25,0)'},{0.703125, 'rgb(255,175.3125,0)'},{0.71875, 'rgb(255,159.375,0)'},{0.734375, 'rgb(255,143.4375,0)'},{0.75, 'rgb(255,127.5,0)'},{0.765625, 'rgb(255,111.5625,0)'},{0.78125, 'rgb(255,95.625,0)'},{0.796875, 'rgb(255,79.6875,0)'},{0.8125, 'rgb(255,63.75,0)'},{0.828125, 'rgb(255,47.8125,0)'},{0.84375, 'rgb(255,31.875,0)'},{0.859375, 'rgb(255,15.9375,0)'},{0.875, 'rgb(255,0,0)'},{0.890625, 'rgb(239.0625,0,0)'},{0.90625, 'rgb(223.125,0,0)'},{0.921875, 'rgb(207.1875,0,0)'},{0.9375, 'rgb(191.25,0,0)'},{0.953125, 'rgb(175.3125,0,0)'},{0.96875, 'rgb(159.375,0,0)'},{0.984375, 'rgb(143.4375,0,0)'},{1, 'rgb(127.5,0,0)'}};

        fp.layout.scene.xaxis.title = xlab_MD;
        fp.layout.scene.yaxis.title = 'yaxis';
        fp.layout.scene.zaxis.title = 'zxis';
        fp.layout.scene.camera.eye.x = -5;
        fp.layout.scene.camera.eye.y = -5;
        fp.layout.scene.camera.eye.z = 3;
        fp.layout.scene.aspectmode = 'data';
        fp.plotly;      
        result = fp.url;

0 个答案:

没有答案