Azzera filtri
Azzera filtri

How to plot a filled box?

32 visualizzazioni (ultimi 30 giorni)
Stephan
Stephan il 5 Dic 2017
Commentato: Stephan il 6 Dic 2017
Hello everyone,
in 2 dimensions I can plot a shaded rectangle with the following code:
h=fill([0,1,1,0],[0,0,2,2],'red');
h.FaceAlpha=0.3;
My question is, how to do the same thing in 3 dimensions (with height=1). Then a rectangle would be a box.
Thanks, Stephan

Risposta accettata

Jos (10584)
Jos (10584) il 5 Dic 2017
Plot each of the sides separately
h = fill3([1 1 2 2],[1 2 2 1],[1 1 1 1],'r', ...
[1 1 2 2],[1 2 2 1],[2 2 2 2],'r', ...
[1 1 1 1],[1 2 2 1],[1 1 2 2],'b', ...
[2 2 2 2],[1 2 2 1],[1 1 2 2],'b', ...
[1 1 2 2],[1 1 1 1],[1 2 2 1],'g-',...
[1 1 2 2],[2 2 2 2],[1 2 2 1],'g-') ;
set(h,'FaceAlpha',0.3) ;

Più risposte (0)

Categorie

Scopri di più su Line Plots in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by