How to make data points on graph transparent or less visible?

I need to plot an contourf plot which represents the density of some data points and over that I need to put those data points. The problem is when I plot them ordinarily, I can barely see anything, so I started experimneting with transparency, but while it's easy to make the contourf plot transparent with alpha command, how can I make the data points transparent? alpha doesn't seem to work for them.
I would like for the data points just to be a slight haze in the background and for the contours too be visible over them.
And one more thing. Where in the plot tools can I find the option to adjust alpha for contourf graph? It's for another figure, but the problem is similar to this one I think. I plot the contourf graph with alpha 0.5. Then I open the plot tools and adjust the x axis to log scale. As I do that Matlab automaticaly sets alpha back to 1 and I cannot find anywhere in the plot tools and docking figure an option to adjust it back
Any help with tese two problems?
Thank you in advance!

Answers (1)

The only renderer that supports transparency is OpenGL, but OpenGL does not support log scale axes.
What are you using to plot your data points at present?

4 Comments

Are you asking what function am I using? This is what the code looks like:
figure
hold on
contourf(diam,dD,z',v)
alpha 0.3
plot(krateri_br(:,3),krateri_br(:,4),'.y','MarkerSize',.1)
colorbar
colormap(jet)
grid on
And I get the result where I cant see the contours because of the data points. The transparency works for contourf but not for plot. Then I would just turn on the log scale on x axis in the plot editor and that would cancel the transparency.
If it's impossible to have the transparency and log scale I would rather have transparency.
It is not possible to define transparency for a line object or lineseries object (which is what plot()) returns.
scatter() would be more natural for your purpose. For up to close to 1000 points, scatter creates a scattergroup object that has one child patch object per point; the alpha of the children can be set. It was recently reported that starting about 1000 points, scatter creates a single patch instead of one per point. It would be possible to set the alpha of that one patch, but it would perhaps be tricky to set it to different values at different locations (if it turned out you needed that.)
I don't think I'll need to set it at different values for different locations. So do I just write something like:
scatter(krateri_br(:,3),krateri_br(:,4))
alpha 0.5
Or is it more complex than that? How do I control these patches and set their alpha?
And can I set one axis in log scale for scatter plot?
I've been reading on scattergroup objects in this link that you sent, but I cannot make anything useful out of it. :( Im' still new at Matlab...

Sign in to comment.

Asked:

on 10 Jul 2012

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!