how to change the axis line color white but maintain the font color black?
    38 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    

I am trying to get a graph look like this, but when I change the color of axis to white the font becomes white too
2 comentarios
  Adam
      
      
 el 27 de Oct. de 2016
				Please post what code you are using. Axes are white by default, with black text. Do you mean you are making the grid lines white? If so when I do this everything else remains unchanged, so I'm not really sure what settings you are changing.
Respuestas (3)
  Image Analyst
      
      
 el 27 de Oct. de 2016
        Does this help:
y = sin([1:40]/10);
plot(y, 'm*-');
grid on;
ax = gca % Get handle to current axes.
ax.XColor = 'r'; % Red
ax.YColor = 'b'; % Blue
ax.GridAlpha = 0.9;  % Make grid lines less transparent.
ax.GridColor = [0.1, 0.7, 0.2]; % Dark Green.

0 comentarios
  Jan
      
      
 el 27 de Oct. de 2016
        Create 2 axes: 1 for the lables and another on top for the grid:
Axes1H = axes('NextPlot', 'add');
Axes1H = axes('NextPlot', 'add', 'YTickLabel', {}, 'XTickLabel', {}, ...
              'XColor', [1,1,1], 'YColor', [1,1,1], ...
              'Color', [0.5, 0.5, 0.5], ...
              'Box', 'on', 'XGrid', 'on', 'YGrid', 'on');
3 comentarios
  Image Analyst
      
      
 el 24 de Jul. de 2020
				
      Editada: Image Analyst
      
      
 el 24 de Jul. de 2020
  
			As I said in my Answer, leave off the semicolon when you call Axes1H.  Then you'll get a partial list of properties you can change.  Click the Show All Properties link to see a list of all of them.  There are lots of things there you can change including the colors and sizes of axes and tick marks.
  Michael Stollenwerk
 el 9 de En. de 2022
				Can someone explain how this works with a generic plot? For example
Axes1H = axes('NextPlot', 'add');
Axes1H = axes('NextPlot', 'add', 'YTickLabel', {}, 'XTickLabel', {}, ...
              'XColor', [1,1,1], 'YColor', [1,1,1], ...
              'Color', [0.5, 0.5, 0.5], ...
               'Box', 'on', 'XGrid', 'on', 'YGrid', 'on');
plot(1:10,2:11)
and 
plot(1:10,2:11)
Axes1H = axes('NextPlot', 'add');
Axes1H = axes('NextPlot', 'add', 'YTickLabel', {}, 'XTickLabel', {}, ...
              'XColor', [1,1,1], 'YColor', [1,1,1], ...
              'Color', [0.5, 0.5, 0.5], ...
               'Box', 'on', 'XGrid', 'on', 'YGrid', 'on');
give  strange figures.
  Image Analyst
      
      
 el 27 de Oct. de 2016
        Do this right after you plot something.
ax = gca   % Don't use a semicolon.
Then, in the command window, click the link to show all properties. There you can see how you can change virtually anything.
Ver también
Categorías
				Más información sobre Axis Labels en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





