Filter löschen
Filter löschen

How to plot a filled box?

24 Ansichten (letzte 30 Tage)
Stephan
Stephan am 5 Dez. 2017
Kommentiert: Stephan am 6 Dez. 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

Akzeptierte Antwort

Jos (10584)
Jos (10584) am 5 Dez. 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) ;

Weitere Antworten (0)

Kategorien

Mehr zu Line Plots finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by