Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
transparency in 3D plots

Subject: transparency in 3D plots

From: Gimer David

Date: 9 Jul, 2010 09:49:03

Message: 1 of 4

Hello everybody,

Firstly excuse me if my english is a little bit approximate, I am actually French. What's more, it is the first time that I use this newsgroup, so I don't necessarily know the ways here, si I am sorry if I misuse it.

I am making a code that represents 3D curves of physical data (Gp and Gpp in the code below) versus time (temps in the code below), and frequency (frequence in the code below). The fact is that it makes surfaces, and in order to make the figure more readable, I have to include transparency. I have tried many of the ways to obtain transparency in the MATLAB help page but didn't succeed. I am wondering if the problem could come from the "excessive" size of my data : Gp ang Gpp are 100x150, temps is 150x1 and frequence is 100x1. I tried to reduce Gp and Gpp to 100x30 and time to 30x1 but it didn't work either.

My code for the plot is :

figure(1)
surf(temps,frequence,Gp,'FaceColor','blue','EdgeColor','none','FaceAlpha',0.8);
camlight headlight; lighting phong;
hold on
surf(temps,frequence,Gpp,'FaceColor','red','EdgeColor','none','FaceAlpha',0.8);
camlight left; lighting phong;

Please, can someone help me to add transparency to my curves?

Thank you in advance,

David.

Subject: transparency in 3D plots

From: Faraz Afzal

Date: 9 Jul, 2010 10:06:04

Message: 2 of 4

"Gimer David" <aufondbienaufond@voila.fr> wrote in message <i16raf$87d$1@fred.mathworks.com>...
> Hello everybody,
>
> Firstly excuse me if my english is a little bit approximate, I am actually French. What's more, it is the first time that I use this newsgroup, so I don't necessarily know the ways here, si I am sorry if I misuse it.
>
> I am making a code that represents 3D curves of physical data (Gp and Gpp in the code below) versus time (temps in the code below), and frequency (frequence in the code below). The fact is that it makes surfaces, and in order to make the figure more readable, I have to include transparency. I have tried many of the ways to obtain transparency in the MATLAB help page but didn't succeed. I am wondering if the problem could come from the "excessive" size of my data : Gp ang Gpp are 100x150, temps is 150x1 and frequence is 100x1. I tried to reduce Gp and Gpp to 100x30 and time to 30x1 but it didn't work either.
>
> My code for the plot is :
>
> figure(1)
> surf(temps,frequence,Gp,'FaceColor','blue','EdgeColor','none','FaceAlpha',0.8);
> camlight headlight; lighting phong;
> hold on
> surf(temps,frequence,Gpp,'FaceColor','red','EdgeColor','none','FaceAlpha',0.8);
> camlight left; lighting phong;
>
> Please, can someone help me to add transparency to my curves?
>
> Thank you in advance,
>
> David.


Hi David...

Your english is perfect.. And you are at the right platform to start with..

Keep ur data as dense it was before and use "mesh" instead of surface..
So it would be like ,

mesh(temps,frequence,Gpp,'FaceColor','red','EdgeColor','none','FaceAlpha',0.8);
camlight left; lighting phong;

and if you want the contour which are normally useful use
meshc(......) and you will get contours of your plot on the plane..
Let me know if it works..

Regards,
Muhammad Faraz

Subject: transparency in 3D plots

From: Steven Lord

Date: 9 Jul, 2010 13:30:25

Message: 3 of 4


"Gimer David" <aufondbienaufond@voila.fr> wrote in message
news:i16raf$87d$1@fred.mathworks.com...
> Hello everybody,
>
> Firstly excuse me if my english is a little bit approximate, I am actually
> French. What's more, it is the first time that I use this newsgroup, so I
> don't necessarily know the ways here, si I am sorry if I misuse it.

Your English is fine, and you included a clear subject line, a clear
description of the problem you're trying to solve, and your own code in your
post. That's a good practice to follow.

> I am making a code that represents 3D curves of physical data (Gp and Gpp
> in the code below) versus time (temps in the code below), and frequency
> (frequence in the code below). The fact is that it makes surfaces, and in
> order to make the figure more readable, I have to include transparency. I
> have tried many of the ways to obtain transparency in the MATLAB help page
> but didn't succeed. I am wondering if the problem could come from the
> "excessive" size of my data : Gp ang Gpp are 100x150, temps is 150x1 and
> frequence is 100x1. I tried to reduce Gp and Gpp to 100x30 and time to
> 30x1 but it didn't work either.

100-by-150 matrices are small examples compared to some of the data that
some of the other posters in this newsgroup deal with.

Anyway, determine the value of your figure's Renderer property.

http://www.mathworks.com/access/helpdesk/help/techdoc/ref/figure_props.html#Renderer

If you want to use transparency, make sure that this figure property is SET
to 'OpenGL'.

*snip*

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: transparency in 3D plots

From: Walter Roberson

Date: 9 Jul, 2010 13:47:55

Message: 4 of 4

Gimer David wrote:

> I am making a code that represents 3D curves of physical data (Gp and
> Gpp in the code below) versus time (temps in the code below), and
> frequency (frequence in the code below). The fact is that it makes
> surfaces, and in order to make the figure more readable, I have to
> include transparency. I have tried many of the ways to obtain
> transparency in the MATLAB help page but didn't succeed.

Is your renderer set to OpenGL ? Surface transparency is only supported
with the OpenGL renderer.

Tags for this Thread

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.

Contact us