Scatter Plot with string in x-axis and integer on y-axis
49 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Mahaveer Uttamchand
am 22 Jul. 2019
Kommentiert: TADA
am 22 Jul. 2019
My data is
samples=["4S1";"4S2";"4S3";"4S4";"4S5"]';
percentage=[0;-11.5000000000000;-2.44000000000000;-8.13000000000000;-2.44000000000000]';
scatter(samples,percentage);
Error Message:
Error using scatter (line 56)
Input arguments must be numeric, datetime, duration or categorical.
Can anyone please help?
2 Kommentare
KALYAN ACHARJYA
am 22 Jul. 2019
I tried with the code, no error in my case. But the question is obvious, samples is strings, how you are going to plot with non numeric variables? Are you looking for Bar Plot?
Akzeptierte Antwort
Mahaveer Uttamchand
am 22 Jul. 2019
2 Kommentare
KALYAN ACHARJYA
am 22 Jul. 2019
Bearbeitet: KALYAN ACHARJYA
am 22 Jul. 2019
Ohh Yes, its Nice, Thank You.
Weitere Antworten (1)
TADA
am 22 Jul. 2019
Maybe bar chart would be better for you, but if you must use scatter plot
scatter(1:5,percentage);
set(gca, 'XTick', 1:5, 'XTickLabel', samples);
2 Kommentare
TADA
am 22 Jul. 2019
One more thing, when you need to plot something but don't know how, its always a good idea to check the plot gallery
Siehe auch
Kategorien
Mehr zu Scatter Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!