Thread Subject: Hardcopy is black - help

Subject: Hardcopy is black - help

From: Geico Caveman

Date: 22 Aug, 2007 05:31:00

Message: 1 of 7

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.

Subject: Hardcopy is black - help

From: Richard Quist

Date: 22 Aug, 2007 11:24:41

Message: 2 of 7

Geico Caveman wrote:
> 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.
>

This usually indicates a problem with the opengl driver. Try starting
MATLAB with the -softwareopengl switch

Subject: Hardcopy is black - help

From: Geico Caveman

Date: 22 Aug, 2007 21:44:08

Message: 3 of 7

Richard Quist wrote:

> Geico Caveman wrote:
>> 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.
>>
>
> This usually indicates a problem with the opengl driver. Try starting
> MATLAB with the -softwareopengl switch

Thanks for your response.

I tried this switch. No good. The hardcopy o/p is black as before.

Subject: Hardcopy is black - help

From: Rich Quist

Date: 23 Aug, 2007 12:47:08

Message: 4 of 7

Geico Caveman <spammers_go_here@spam.invalid> wrote in
message <faian9$n9r$1@news.asu.edu>...
> Richard Quist wrote:
>
> > Geico Caveman wrote:
> >> 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.
> >>
> >
> > This usually indicates a problem with the opengl driver.
Try starting
> > MATLAB with the -softwareopengl switch
>
> Thanks for your response.
>
> I tried this switch. No good. The hardcopy o/p is black as
before.

You can try "forcing" print to use a different renderer,
which may help. Try adding '-zbuffer' to the print command
(the other choice for the png format would be '-opengl', but
that's probably what's being used currently).

The other thing to look at is whether there's an update for
your video driver

Subject: Hardcopy is black - help

From: Geico Caveman

Date: 24 Aug, 2007 19:02:15

Message: 5 of 7

Rich Quist wrote:

> Geico Caveman <spammers_go_here@spam.invalid> wrote in
> message <faian9$n9r$1@news.asu.edu>...
>> Richard Quist wrote:
>>
>> > Geico Caveman wrote:
>> >> 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.
>> >>
>> >
>> > This usually indicates a problem with the opengl driver.
> Try starting
>> > MATLAB with the -softwareopengl switch
>>
>> Thanks for your response.
>>
>> I tried this switch. No good. The hardcopy o/p is black as
> before.
>
> You can try "forcing" print to use a different renderer,
> which may help. Try adding '-zbuffer' to the print command
> (the other choice for the png format would be '-opengl', but
> that's probably what's being used currently).
>
> The other thing to look at is whether there's an update for
> your video driver

I will look into this. However, I found an older machine with Matlab 7 on
it. The hardcopy generated by the same code on that machine is perfect.

Something changed 7 -> 7.4.

Subject: Hardcopy is black - help

From: Geico Caveman

Date: 30 Aug, 2007 02:45:16

Message: 6 of 7

Rich Quist wrote:

> Geico Caveman <spammers_go_here@spam.invalid> wrote in
> message <faian9$n9r$1@news.asu.edu>...
>> Richard Quist wrote:
>>
>> > Geico Caveman wrote:
>> >> 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.
>> >>
>> >
>> > This usually indicates a problem with the opengl driver.
> Try starting
>> > MATLAB with the -softwareopengl switch
>>
>> Thanks for your response.
>>
>> I tried this switch. No good. The hardcopy o/p is black as
> before.
>
> You can try "forcing" print to use a different renderer,
> which may help. Try adding '-zbuffer' to the print command
> (the other choice for the png format would be '-opengl', but
> that's probably what's being used currently).
>
> The other thing to look at is whether there's an update for
> your video driver

As a matter of record, I found that zbuffer worked for me. There appears to
be some loss of resolution though.

I did not use a command line switch. Instead, I use a set() on gcf for this.

Subject: Hardcopy is black - help

From: Pooky Pooky

Date: 18 Mar, 2009 20:26:01

Message: 7 of 7

Geico Caveman <spammers-go-here@spam.invalid> wrote in message <fb5b00$n2b$1@aioe.org>...
> Rich Quist wrote:
>
> > Geico Caveman <spammers_go_here@spam.invalid> wrote in
> > message <faian9$n9r$1@news.asu.edu>...
> >> Richard Quist wrote:
> >>
> >> > Geico Caveman wrote:
> >> >> 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.
> >> >>
> >> >
> >> > This usually indicates a problem with the opengl driver.
> > Try starting
> >> > MATLAB with the -softwareopengl switch
> >>
> >> Thanks for your response.
> >>
> >> I tried this switch. No good. The hardcopy o/p is black as
> > before.
> >
> > You can try "forcing" print to use a different renderer,
> > which may help. Try adding '-zbuffer' to the print command
> > (the other choice for the png format would be '-opengl', but
> > that's probably what's being used currently).
> >
> > The other thing to look at is whether there's an update for
> > your video driver
>
> As a matter of record, I found that zbuffer worked for me. There appears to
> be some loss of resolution though.
>
> I did not use a command line switch. Instead, I use a set() on gcf for this.



I used the 'print' command, and -zbuffer switch which turned out to be a practical workaround. Very helpful posts, thanks!

OS: WinXP; MATLAB ver.: 7.6.0; Image type: JPEG

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
opengl Richard Quist 23 Aug, 2007 08:43:42
export Richard Quist 23 Aug, 2007 08:43:17
print Richard Quist 23 Aug, 2007 08:43:17
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com