Channing color, marker size and type in a gscatter
42 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Yaser Khojah
il 27 Gen 2021
Commentato: Yaser Khojah
il 31 Gen 2021
I am trying to change the color in a gscatter plot with the maker size and type as below. I could not change the color and size. Anyway to help please
Field_Size = rand(1,8);
tau = rand(1,8);
Field = 1:8;
color = [0.19608 0.80392 0.19608, 0.72941 0.33333 0.83922, 1,0];
markers = {'s' '^' 'p' 'h' 'v' 'd' 'x' 'o'};
figure
ylabel('\tau^{*} (Year)')
xlabel('Field Size (TSCF)')
gsh = gscatter(Field_Size,tau,Field);
% Set markers
%must match number of groups!
set(gsh,{'Marker'}, markers(:))
% fill markers
set(gsh,{'MarkerFaceColor'}, color)
0 Commenti
Risposta accettata
Cris LaPierre
il 27 Gen 2021
Most of this can be done by taking advantage of the optional inputs to gscatter:
Here's one way.
Field_Size = rand(1,8);
tau = rand(1,8);
Field = 1:8;
color = hsv(length(Field));
markers = 's^phvdxo';
sz = 6:2:20;
gsh = gscatter(Field_Size,tau,Field,color,markers,sz,'on','Field Size (TSCF)','\tau^{*} (Year)');
% fill markers
for g = 1:length(gsh)
gsh(g).MarkerFaceColor = gsh(g).Color;
end
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Graphics Objects in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!