help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pcolor and plot graphs transparent


From: Avraham Rosenberg
Subject: Re: pcolor and plot graphs transparent
Date: Sat, 3 Mar 2012 09:02:31 +0200
User-agent: Mutt/1.5.20 (2009-06-14)

On Fri, Mar 02, 2012 at 11:43:55AM +0100, Sophia Lianou wrote:
> Thank you very much for your responses. I attach a jpeg
> (transparent_cmd.jpg) that shows the outcome I would like to have --
> produced using Matlab.
> 
> I also attach a sub-set of the input pht file (eso540_030.pht), which now
> reads differently -- see the appended code at the end.
> 
> There is a solution to this problem, but working in Matlab, and using
> "surf", instead of "pcolor", with additional "set" parameters. When I use
>  Octave, although the code runs without any "complaint", it fails to give
> the correct output figure. Given that my access to Matlab is limited, I
> will appreciate any help to resolve this issue, using Octave.
> 
> I append below the new code that works fine with Matlab. The part of the
> code to look is the "%% plotting".
> 
> Thank you again for the help.
> 
> PS: plotting first the density map and then the "grey points" is again
> obscuring the density map.
> 
> %%%%%%%%%%%%%%%%%%
>   clear;
>   data1 = load ('eso540_030.pht');
> 
> %% global properties
>   x1 = data1(:,1);
>   y1 = data1(:,2);
>   mvo1 = data1(:,3);
>   mio1 = data1(:,4);
>   col1 = mvo1 - mio1;
> 
> %% compute density
>   dcol=0.1;
>   colbin = -0.4:dcol:2.2;
>   di = 0.1;
>   ibin = 22.2:di:28.2;
> 
>   density = zeros(length(colbin),length(ibin));
> 
>   for i = 1:length(colbin)
>      for j = 1:length(ibin)
>          density(i,j) = length(mio1(col1>colbin(i)-dcol/2 &
> col1<=colbin(i)+dcol/2 & mio1>ibin(j)-di/2 & mio1<=ibin(j)+di/2));
>      end;
>   end;
> 
>   [xx yy]=meshgrid (colbin,ibin);
> 
> %% plotting
>   figure(1); clf
>   hold on
>   %
>   plot(col1,mio1, '+', 'Color', [0 0 0], 'MarkerSize',2);
>   %
>   p = surf(xx, yy, density');
>   set(p,'FaceAlpha',.55,'AlphaDataMapping','scaled','AlphaData',colbin);
>   %alphamap('vup');
>   shading interp;
>   colormap(flipud(hot));
> 
> %% figure parameters
>   axis([-0.4 2.2 22.2 28.2]);
>   xlabel('F606W - F814W','FontSize', 14);
>   ylabel('F814W','FontSize', 14);
>   set(gca,'YDir','reverse');
>   set(gca, 'XMinorTick', 'on', 'YMinorTick', 'on')
>   axis square
>   text(-0.3,22.6,'E540-030','FontSize', 12)
> 
> %% Print the figure
>  %print -depsc transparent_cmd.eps  % in matlab
>  %print -deps -color transparent_cmd.eps  % in octave

Good morning,
   Thank you for the data. I had imagined a different sort of
graph...Clearly my suggestion cannot work in this case.
  I looked at the help for print in my octave install (octave 3.4.3
on linux Debian squeeze): I did not see the transparent option. Is there
such a option in your install?
   Assuming that there is not, or that it does not work, the
only way out that I see, is to "print" the two graphs to a format that
allows transparency, or an alpha-channel and combine them afterwards. Such
formats are gif or png (raster graphics) and eps type 3 (vector graphics).
I am not sure about the svg scalable vector format. I am not familiar with
it. Maybe our more knowledgeable coleagues will be able to fill in, or/and
suggest some better way. 
   Accordind to the documentation, in order to obtain the eps type 3 format
you will have to use the FLTK graphic toolkit.

   Good luck, Avraham

-- 
Please avoid sending Excel or Powerpoint attachments to this address.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]