Plotting a Graph with Shapes and Colours

I am plotting some results from experiments: I essentially need to plot markers of several different shapes on a figure and then have come of them in one colour and others in another colour.
I currently have the following, so I need to be able to plot a point on either figure with a shape and colour and then have a legend which specifies the meaning of each shape, plus the meaning of the colour.
figure
grid
%xlabel('R')
box on
% lgdc = sprintfc('K_n = %3.1f', Knv);
legend('Location','SE')
fsz = 10; % Fontsize
% alw = 1.5; % LineWidth
msz =10;
xlabel('Kn / (\surd(\pi/2) \mu \surdRT) / Lp')
ylabel('We / \rho U^2 L / \sigma')
set(gca, 'FontSize',fsz);
saveas(gcf,'KnudsenvsWeber','jpeg')
figure
grid
%xlabel('R')
box on
% lgdc = sprintfc('K_n = %3.1f', Knv);
legend('Location','SE')
fsz = 10; % Fontsize
% alw = 1.5; % LineWidth
msz =10;
xlabel('Gas density / kg m^{-3}')
ylabel('Entry speed / m s^{-1}')
set(gca, 'FontSize',fsz);
saveas(gcf,'Densityvsentryspeed','jpeg')

3 Kommentare

darova
darova am 17 Feb. 2020
You can plot a points using plot() function
Tom
Tom am 17 Feb. 2020
This is useful actually as I only need a few points, what would be the best way of adding the legend which specifies the value of the shapes and colours separately?
Tom
Tom am 17 Feb. 2020
Also this plot() functions only seems to allow me to plot one point on the graph, how do I plot multiple points where I wish on the same figure?

Melden Sie sich an, um zu kommentieren.

 Akzeptierte Antwort

darova
darova am 17 Feb. 2020

1 Stimme

An example
h1 = plot(1,1,'.r'); % red point
hold on
h2 = plot(2,2,'.b'); % blue point
hold off
legend([h1 h2],'red point','blue point')

Weitere Antworten (0)

Kategorien

Mehr zu Creating, Deleting, and Querying Graphics Objects finden Sie in Hilfe-Center und File Exchange

Produkte

Gefragt:

Tom
am 17 Feb. 2020

Beantwortet:

am 17 Feb. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by