File Exchange Pick of the Week

July 27th, 2007

Shading plots for emphasis

shading.jpg

Sometimes showing the data in a plot is just not enough. You need to be able to emphasize the parts that are the most important for the viewer of the plot. ShadePlotForEmphasis will do just that.

I like that this function comes with useful help, and a demo and that Michael kept the syntax very concise:


G={today-[30 51]};
ShadePlotForEmpahsis(G,’g',0.5);

15 Responses to “Shading plots for emphasis”

  1. Eric Magee replied on :

    This is great. The one thing I did find is that the transparency behaviour for patch (and fill) is different when the axes are logarithmic (at least in 2006b). When the axes are linear, the lines and the grids are visibile if the FaceAlpha is set

  2. Eric Magee replied on :

    What I wanted to say above, but ran out of room, is that the transparency part does not work the same when the axes are logarithmic. The lines are visible but the gridlines are not.

  3. Francisco Bido replied on :

    Doug,

    I encourage you to provide some feedback to the graphics Developers. There are many of us Economists using Matlab and need a more refined version (more features and options) for this type of plot.

    Thanks!
    -Francisco

  4. sridharan kamalakannan replied on :

    I have a stack of 2D polygons. Can u suggest me a way to stack these polygons in 3D such that I get a 3D object out of these 2D polygons.

  5. Doug replied on :

    Sri,

    I am not sure I understand your question. Can you rephrase and elaborate?

    Thanks,
    Doug

  6. Sridharan Kamalakannan replied on :

    I have corodinates corresponding to 2-D polygons. There are ‘n’ such polygons which have ‘n’ different Z values. Basically they are polygons in different slices. I want to stack these polygons so that I can visually see a smooth 3-D object.

  7. Sridharan Kamalakannan replied on :

    Hi Doug,

    I have another question.

    I have a polygon which i coverted to a mask by using poly2mask command. Now i have to color the mask by using patch, i.e. i want to superimpose a color mask on an image such that I can adjust the transparency of the mask.

    In short I would like to know if there is some command to fill specific pixels with a color such that its transparency can be adjusted.

  8. Doug replied on :

    To your 2-d stacking problem above (6)

    http://www.mathworks.com/access/helpdesk/help/techdoc/ref/delaunay3.html

    Delaunay functions might be just what you are looking for.

    Transparency is controlled with Alpha:

    http://www.mathworks.com/access/helpdesk/help/techdoc/ref/alpha.html

    To set individual values based on your mask, you will want to review my video here:

    http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=16344&objectType=FILE

    Enjoy,
    Doug

    http://blogs.mathworks.com/pick

  9. KG replied on :

    In a 2d or 3d plot, how can you have set an axis in the logarithmic scale. i do not want to do it from the plot window, but wish to have this in the .m file itself while setting the axis.

  10. Doug replied on :

    KG:

    Try this:

    set(gca,’YScale’,'log’)

    Enjoy!
    Doug

  11. Olena replied on :

    Hello,
    How do you get rid of 10^5 in the lower right corner? Thank you,
    Olena

  12. Olena replied on :

    The bug and solutions are reported over here:
    http://www.mathworks.com/support/bugreports/details.html?rp=327079

    I found the last workaround to be the most useful one.

  13. Ahmed replied on :

    I have a surf and fill3 done on linear scale; but when I change the scale to lagarithmic using plot window, the plot loses its transparency. Is ther a way to keep the tranparency even after changing the scale to logarithmic from plot window.

  14. Doug replied on :

    Ahmed,

    Check the renderer
    >>get(gcf,’renderer’)

    Make sure it is openGL. That is the only renderer in MATLAB that supports transparency. I suspect it got changed and that is why you lost the effect.

    Doug

  15. James replied on :

    I have two question about this fucntion
    1. my first question is the same as the eleventh reviewer’s: how to get rid of the label, 10^5, on the lower right corner of the plot.
    2. the second one is how to copy the plot into a word or ppt file with losing any resolution. The copied plot either has very bad resolution or lose the transparency of pacthed area . I tried differrent ways, e.g. copy it directly from MATLAB, save or print it in eps, jgn,jpg,emf …. they just did not work.

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


Bob, Brett & Jiro share their favorite user-contributed submissions from the File Exchange.

  • Zach: Hi Doug and Les, I didn’t have a lot of time to mess with this, but I did find a work-around. I plotted...
  • hamed: k
  • Les: @Zach This isn’t exactly what you are looking for but at least it puts all three parameters on the same...
  • Zach: Thanks for your suggestions Doug. I’ll give that a shot and see what happens. I’ve seen many of...
  • Doug: @Zach, I would say to use plotYYY, because that is close to what you want, but using depth as Y makes sense....
  • Doug: @Teja, I think this will work: http://www.mathworks .com/access/helpdesk /help/techdoc/ref...
  • Gify: merry christmas :) nice christmas tree! Regards, Janet Gify
  • Teja: Dear Doug Is there anyway to plot a surface from nonuniform data without meshgrid and griddata? Basically i...
  • Zach: I’m working with geophysical data, so I’d like to produce a depth profile. The y-axis would be...
  • Doug: @Ashok First, please do not use variable names that are MATLAB commands (std and mean). Second, p(j) should be...

These postings are the author's and don't necessarily represent the opinions of The MathWorks.