Split Y axis into two with different colors
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Guilherme Salome
el 30 de Ag. de 2017
Editada: Guilherme Salome
el 30 de Ag. de 2017
I am trying to plot two sequences of bars, using the same y-axis. One of the sequences goes on the bottom, the other goes on top (from top to bottom), and the y axis is split into two (half for the bottom bars and half for the top bars). The bottom bars use one color, like green, and the top bars use another color, red, and the y axis uses the respective colors on each half on the axis.
Example:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/166959/image.jpeg)
I have absolutely no idea how to split the y-axis in this way. Could someone please help me?
Thanks for helping! =D
0 comentarios
Respuesta aceptada
Más respuestas (1)
Jan
el 30 de Ag. de 2017
Editada: Jan
el 30 de Ag. de 2017
Do you mean something like this:
x = rand(1, 8);
axes2 = axes('NextPlot', 'add', 'Visible', 'on', 'YDir', 'normal', 'YLim', [0, 2]);
bar(x, 'g');
axes2 = axes('NextPlot', 'add', 'Visible', 'off', 'YDir', 'reverse', 'YLim', [0, 2]);
bar(x, 'r');
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/178015/image.png)
Or does the question concern the tick marks? This can be included also.
0 comentarios
Ver también
Categorías
Más información sobre 2-D and 3-D Plots en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!