A plot with four subplots (quadrants)
51 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello,
I am working on a mood detection algorithm (from music) and I am currently stuck at the GUI.
I need to plot something similar to Thayer's arousal-valence emotion plane (four quadrants), here's what it looks like: Thayer
Now, it's not really technical, it's more about formatting the plot so it looks like that. I've tried everything I can but couldn't get to that result.
Basically what I need to do is this: if my function returns 1, a point would be plotted on the yellow panel (scatter plot maybe?), if answer is 2 - green, 3 - blue, 4 - red.
Is it possible? If it is, any idea of how I can do this?
Thank you in advance!
M.
3 commentaires
Sara
le 16 Avr 2014
You can use the quadrants of a classic plot: x>0,y>0 for yellow; x<0,y>0 for red and so on. In this way it's just one plot. And if you want to color the background, you can use the patch command.
Réponse acceptée
Kelly Kearney
le 16 Avr 2014
There are several options of the file exchange to alter the spacing/margins/etc. of subplots (e.g. subaxis). Though for just 4 plots just using axes with the 'position' option should suffice:
l = [0.1 0.5; 0.1 0.5];
b = [0.5 0.5; 0.1 0.1];
c = {'r', 'y'; 'b', 'g'};
for ii = 1:4
ax(ii) = axes('position', [l(ii) b(ii) 0.4 0.4], 'color', c{ii});
end
Plus de réponses (2)
Image Analyst
le 16 Avr 2014
If you have multiple subplots, you need to do some tricky stuff to get them close together. Why not just create an image and display that in a single axes control? Then put annotation over it with plot(), annotation(), text(), etc..
4 commentaires
Image Analyst
le 17 Avr 2014
That's not what I was thinking, but that might work too. Just use patch() or fill() to put up a colored rectangle.
Mihnea
le 17 Avr 2014
3 commentaires
Kelly Kearney
le 17 Avr 2014
Assuming this comment applied to my solution, you can set the xcolor and ycolor properties to match your figure background. I'm assuming for now you're not interested in tick labels; if you need those it might require a bit more fiddling.
set(gcf, 'color', 'w');
set(ax, 'xcolor', 'w', 'ycolor', 'w', 'xtick', [], 'ytick', [])
Voir également
Catégories
En savoir plus sur Annotations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!