Thread Subject: Help with plotting transparent data points?

Subject: Help with plotting transparent data points?

From: adam

Date: 15 Jun, 2009 22:38:23

Message: 1 of 3

Hello Friends,

I have a large set of overlapping data points that I would like to
plot, and give each data point an alpha of say, 0.25, so we'll have
darker regions where more data points overlap. I can't seem to figure
out how to use the matlab alpha commands to accomplish this. Can
anyone help?

I'm plotting the phase space of an elegant strange henon attractor:
(unoptimized code follows). Basically, I want the resulting plot to
look a lot better than it does now -- essentially anti-aliasing the
output by assigning a non-unity alpha value to each data point.

Thanks for the tips,

Adam Attarian

a=-0.89567065;
b=1.5909586;
c=1.851583;
d=2.1974306;
N=1E6;

for n=2:N
    x(n)=sin(a*y(n-1))-cos(b*x(n-1));
    y(n)=sin(c*x(n-1))-cos(d*y(n-1));
end

h=plot(x,y,'k.','MarkerSize',1);

Subject: Help with plotting transparent data points?

From: TideMan

Date: 16 Jun, 2009 02:27:54

Message: 2 of 3

On Jun 16, 10:38 am, adam <adam.attar...@gmail.com> wrote:
> Hello Friends,
>
> I have a large set of overlapping data points that I would like to
> plot, and give each data point an alpha of say, 0.25, so we'll have
> darker regions where more data points overlap. I can't seem to figure
> out how to use the matlab alpha commands to accomplish this. Can
> anyone help?
>
> I'm plotting the phase space of an elegant strange henon attractor:
> (unoptimized code follows). Basically, I want the resulting plot to
> look a lot better than it does now -- essentially anti-aliasing the
> output by assigning a non-unity alpha value to each data point.
>
> Thanks for the tips,
>
> Adam Attarian
>
> a=-0.89567065;
> b=1.5909586;
> c=1.851583;
> d=2.1974306;
> N=1E6;
>
> for n=2:N
>     x(n)=sin(a*y(n-1))-cos(b*x(n-1));
>     y(n)=sin(c*x(n-1))-cos(d*y(n-1));
> end
>
> h=plot(x,y,'k.','MarkerSize',1);

I'm not sure you can use alpha when you are plotting
markers.............

I tried your code and found that using 'Color',[0.9 0.9 0.9] in the
plot command gave grey markers that are darker when overplotted. This
may give the effect you're looking for.

Incidentally, I needed to add these commands to make your code work
properly:
x=zeros(N,1);y=x;

Subject: Help with plotting transparent data points?

From: Nina Heisel

Date: 1 Jul, 2009 12:54:01

Message: 3 of 3

I have got the same Problem i have tried to solve it using this code.

Bit it did not work. Any other ideas?

load PDXprecip.dat; % read data into PDXprecip matrix
month = PDXprecip(:,1); % copy first column of PDXprecip into month
precip = PDXprecip(:,2); % and second column into precip
alpha(0.1)
Q=scatter(month,precip,'x'); % plot precip vs. month with circles
%get(Q)

%set(Q,'CData',[1 0 1]);
P=get(Q,'Children');
set(P(1),'FaceAlpha',0.002)
set(P(1),'FaceVertexAlphaData',[0.1])
set(P(1),'EdgeAlpha',0.00002)
set(P(1),'MarkerEdgeColor',[0 1 0])
set(P(1),'MarkerSize',[15])
set(P(1),'FaceColor',[0 1 0])
set(P(1),'EdgeColor',[0 1 0])


set(P(2),'FaceAlpha',0.2)
set(P(2),'FaceVertexAlphaData',[0.1])
set(P(2),'EdgeAlpha',0.2)
set(P(2),'MarkerEdgeColor',[0 1 0])
set(P(2),'MarkerSize',[15])
set(P(2),'FaceColor',[1 0 0])
set(P(2),'EdgeColor',[1 0 0])
get(P(2))

get(P(3))
refresh



adam <adam.attarian@gmail.com> wrote in message <1f14247a-c43c-47a7-bef0-998fa1b98740@d19g2000prh.googlegroups.com>...
> Hello Friends,
>
> I have a large set of overlapping data points that I would like to
> plot, and give each data point an alpha of say, 0.25, so we'll have
> darker regions where more data points overlap. I can't seem to figure
> out how to use the matlab alpha commands to accomplish this. Can
> anyone help?
>
> I'm plotting the phase space of an elegant strange henon attractor:
> (unoptimized code follows). Basically, I want the resulting plot to
> look a lot better than it does now -- essentially anti-aliasing the
> output by assigning a non-unity alpha value to each data point.
>
> Thanks for the tips,
>
> Adam Attarian
>
> a=-0.89567065;
> b=1.5909586;
> c=1.851583;
> d=2.1974306;
> N=1E6;
>
> for n=2:N
> x(n)=sin(a*y(n-1))-cos(b*x(n-1));
> y(n)=sin(c*x(n-1))-cos(d*y(n-1));
> end
>
> h=plot(x,y,'k.','MarkerSize',1);

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
data points Sprinceana 22 Jun, 2009 06:46:29
plot data points Sprinceana 22 Jun, 2009 06:46:29
plot Sprinceana 22 Jun, 2009 06:46:29
rssFeed for this Thread

Contact us at files@mathworks.com