See the property descriptions for more details. Currently, all the points are marked as the same color in the legend (attached) dp. Use the AlphaDataMapping property to control how the objects interpret the alpha data values. Learn more about legend, matlab, scatter, plot MATLAB I am using the following code and want to create a legend where different colors correspond to different dosage. Then, specify flat transparencyīy setting either the MarkerFaceAlpha or MarkerEdgeAlpha property to First, specify the transparency values by setting the AlphaData property to an array the same size as the Scatter plots - Specify a different transparency value for each Then, specify flat or interpolated transparency by setting the FaceAlpha and EdgeAlpha properties to either 'flat' or 'interp'. First, specify the transparency values by setting the FaceVertexAlphaData property to a column vector with length equal to either the number of faces (for flat transparency) or the number of vertices in the patch (for interpolated transparency). Link Commented: Benjamin Kraus on I understand how to use the patch function to create a shaded transparent rectangle when the x and y values are just numbers. Additionally, you can specify whether to use flat or interpolated transparency across each face or edge. Patches - Specify a different transparency value for each face and edge. First, specify the transparency values by setting the AlphaData property to an array the same size as the ZData property. Specify the values by setting the AlphaData property to an array the same size as the CData property.Ĭhart and primitive surfaces - Specify a different transparency value for each face and edge. Images - Specify a different transparency value for each image element. % Replace default input arguments by input values % Default alpha value for the cube's faces % Default coordinates of the origin point of the cube % * COLOR : 3-elements vector that defines the faces color of the cube % * ALPHA : scalar that defines the transparency of the cube faces (from 0 % * ORIGIN: 3-elements vector that defines the start point of the cube % * EDGES : 3-elements vector that defines the length of cube edges % PLOTCUBE(EDGES,ORIGIN,ALPHA,COLOR) displays a 3D-cube in the current axes % PLOTCUBE - Display a 3D-cube in the current axes Here is the 'plotcube' code in case the link to the original code by Oliver breaks someday: function plotcube(varargin) This would require changing the code somehow to update all the XYZ data. I believe this is from calling the 'patch' function multiple times.Ī better solution would be to vectorise to put all your points (vertices/faces/whatever) together in a single matrix first and then call the function only once (no 'for' loop). running this 'plotcube' function in a 'for' loop in MATLAB over thousands of blocks. for large models (many cubes) this is very slow to run.Į.g. This table shows the difference between an opaque and semitransparent surface. Add transparency to graphics objects to customize the look of your charts or reveal details about an object that are otherwise hidden. (above) change the section in Olivers code, adding in the four extra lines of code as follows: (replace the whole cellfun section with this including the new 'EdgeAlpha' and 'EdgeColor' lines): % Set this value to whatever you want even a variable / matrixįor more info on 'patch' please see patch documentation. The transparency of a graphics object determines the degree to which you can see through it. fixed edge colour, or a colour that changes with Z-value etc.) Change the colour of the lines (EdgeColor).Īll of these can be constants, or variables.Change the transparency of the edges (EdgeAlpha), and/or,.Change the transparency of the faces (FaceAlpha), and/or,.The advantage of this solution is that you can: I understand this is a late reply but it is still valid in case anyone else is looking at doing the same thing.Īssuming you are plotting cubes (/their edges), an alternative to the answers already provided is to use the 'plotcube' code from Oliver: It has the advantage that it creates a single graphic object: %# these don't all have to be the same
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |