How to put strings on the x axes
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Seyhan Emre Gorucu
il 31 Mag 2012
Commentato: Nathaniel Werner
il 25 Ago 2017
Hello,
I want to plot types of methods vs their corresponding numbers. That is, X axes will be string and Y axes will be numbers. Currently, my matrix is cell as below:
neworder =
'N2' [0.1700]
'HC' [0.1700]
'SAGD' [0.1800]
'Steamflood' [0.4500]
'CSS' [0.4500]
'hot Water' [0.4500]
'CO2' [0.5100]
'Polymer' [0.6300]
'ASP' [0.6300]
'Combustion' [0.6500]
I tried to plot string vs. numbers. It didn't work out. Basically, my X axes is the first column and Y axes is the second column.
Thank you,
0 Commenti
Risposta accettata
Oleg Komarov
il 31 Mag 2012
neworder = {
'N2' [0.1700]
'HC' [0.1700]
'SAGD' [0.1800]
'Steamflood' [0.4500]
'CSS' [0.4500]
'hot Water' [0.4500]
'CO2' [0.5100]
'Polymer' [0.6300]
'ASP' [0.6300]
'Combustion' [0.6500]}
bar([neworder{:,2}])
set(gca,'XtickL',neworder(:,1))
2 Commenti
Nathaniel Werner
il 25 Ago 2017
I have a similar problem.
I am trying to do this in my code
data_strings = {...
'-[(u^\prime\cdot\nabla)\omega_r^\prime]^*' [-2.5 -1.6 -1. -2.1 -1.25 -0.85]...
'[(\omega^\prime\cdot\nabla)u_r^\prime]_\perp^*' [0.15 0.05 0.01 2.2 1.04 0.5]...
'[(\omega^\prime\cdot\nabla)u_r^\prime]_{||}^*' [0.3 0.25 0.1 -1.3 -0.65 -0.62]...
'[-(2\Omega\cdot\nabla)u_r^\prime]^*' [0.87 0.7 0.77 1 0.81 0.79]
'[\nu\nabla^2\omega_r^\prime]^*' [0.6 0.42 0.3 0.12 0.17 0.05]};
But I keep getting the following error.
Error using vertcat
Dimensions of matrices being concatenated are not consistent.
Is there a way I can make this work?
Più risposte (1)
Thomas
il 31 Mag 2012
figure1 = figure;
axes1 = axes('Parent',figure1,'XTickLabel',neworder(:,1));
box(axes1,'on');
hold(axes1,'all');
% Create plot
plot(cell2mat(neworder(:,2)));
or
bar(cell2mat(neworder(:,2)))
Vedere anche
Categorie
Scopri di più su Migrate GUIDE Apps 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!