binning the x-axis of a plot
Mostrar comentarios más antiguos
I need to create bins for the x-axis of my plot. The axis goes from 0 to 20, and I need to make bins corresponding to every .10 of a value; i.e. 5.0 to 5.10. How would I go about doing this?
Respuestas (1)
Walter Roberson
el 9 de Feb. de 2016
xbins = 0 : 0.10 : 20;
4 comentarios
jgillis16
el 9 de Feb. de 2016
Walter Roberson
el 9 de Feb. de 2016
Include it in what sense? Do you want each point labeled with its bin number? Do you want a second x axis that is labeled with bin numbers?
jgillis16
el 9 de Feb. de 2016
Walter Roberson
el 9 de Feb. de 2016
xbins = 0 : 0.10 : 20;
plot(r,txx2);
set(gca, 'xtick', xbins)
But what I suspect you want is something closer to
bar(r, txx2)
Categorías
Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!