Effacer les filtres
Effacer les filtres

Line with variable width and Cdata coloring

11 vues (au cours des 30 derniers jours)
Robin
Robin le 2 Avr 2015
Commenté : Robin le 2 Avr 2015
I am able to plot a line with a separate data vector specifying the CData by plotting a surface and viewing it from the side:
h = surface('XData',[x(:) x(:)], 'YData',[y(:) y(:)], 'ZData',zeros(length(x(:)),2), 'CData',[c(:) c(:)], 'FaceColor','none', 'EdgeColor','flat', 'Marker','none');
I would now like to vary the width of the line according to the CData as well. Is there any function or suggested way to do this?
  1 commentaire
Robin
Robin le 2 Avr 2015
I am able to change the vertical width using surface as below, but this is not quite right - because vertical width is not the same as line width when the line is not horizontal.
Finding the direction of the line and expanding the surface segment perpendicular to the line seems like it will be quite difficult.
widthrange = maxwidth-minwidth;
width = ((c ./ max(c))*widthrange) + minwidth;
h = surface(...
'XData',[x(:) x(:)],...
'YData',[y(:)-(width/2) y(:)+(width/2)],...
'ZData',zeros(length(x(:)),2),...
'CData',[c(:) c(:)],...
'FaceColor','interp',...
'EdgeColor','interp',...
'Marker','none');

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Scatter Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by