Path: news.mathworks.com!newsfeed-00.mathworks.com!oleane.net!oleane!news.ecp.fr!aioe.org!not-for-mail
From: Geico Caveman <spammers-go-here@spam.invalid>
Newsgroups: comp.soft-sys.matlab
Subject: Hardcopy is black - help
Date: Tue, 21 Aug 2007 22:31:00 -0700
Organization: Dinosaur Fedex
Lines: 49
Message-ID: <faghn0$tlv$1@aioe.org>
NNTP-Posting-Host: jxc0V9gZro3LX/plZqqeHw.user.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7Bit
X-Complaints-To: abuse@aioe.org
User-Agent: KNode/0.10.4
Xref: news.mathworks.com comp.soft-sys.matlab:424887



Hello

        I have had this problem before with this script that plots some 3D data
(surf). The figure window shows a nice plot. The hardcopy (pdf and png)
simply consist of a solid black rectangle where the plot ought to be.

        Earlier suggestions included (I was using Matlab 7 on Linux at the time)
using :

        set(gcf,'color','w','inverthardcopy','off');

        Now (I am using Matlab 7.4 on Linux), the presence or absence of this makes
no difference.

        The precise plotting code is :

    close all;
    h=figure(1);
    set(h,'Name',strcat(datafile1,namestring));
    xmin=min(x);
    xmax=max(x);
    ymin=min(y);
    ymax=max(y);
    surf(x',y,height');
    axis([xmin xmax ymin ymax]);
    %set(gca, 'color', [0 1 0]);
    %set(gcf,'color','w','inverthardcopy','off');
    colormap(jet(512));
    shading interp;
    h=colorbar('EastOutside');
    set(get(h,'title'),'String', '\mu m')
    %set(h,'YColor','black');
    %set(h,'FontWeight','bold');
    %set(h,'FontSize',16);
    %view(0,90);
    view([0 0 1]);
    xlabel('x(\mu m)');
    ylabel('y(\mu m)');
    %grid on;
    title(strcat(datafile1,' - height'));

    printcommand=['print -dpdf ',datafile1,'.pdf'];
    eval(printcommand);
    printcommand=['print -dpng ',datafile1,'.png'];
    eval(printcommand);

        Any suggestions to fix this problem would be appreciated.

Thanks.