When I generate plots using the seaborn "white" style I see major tick labels but I don't see any major tick marks.
Setting major tick marks to be bigger using...
%matplotlib inline
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_style('white', {'axes.linewidth': 0.5})
plt.rcParams['xtick.major.size'] = 20
plt.rcParams['xtick.major.width'] = 4
fig, ax = plt.subplots()
plt.show()
...has no effect.
I can't find any option that would make the tick marks visible/invisible.
Anybody have any clues?
Ticks are easier to identify once they are done feeding because their body becomes engorged. The scutum remains the same size, but the body will become larger and change color once feeding is complete. The colors range from brownish red to pale gray or greenish grey.
To set the color for X-axis and Y-axis, we can use the set_color() method (Set both the edgecolor and the facecolor). To set the ticks color, use tick_params method for axes. Used arguments are axis ='x' (or y or both) and color = 'red' (or green or yellow or ...etc.)
Use left=false and bottom=false to remove the tick marks.
The rcParams 'xtick.major.size'
and 'xtick.major.width'
can indeed be used to change the length and width of the ticks. The rcParams 'xtick.bottom'
and 'ytick.left'
can be used to set the ticks on or off.
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_style('white', {'axes.linewidth': 0.5})
plt.rcParams['xtick.major.size'] = 20
plt.rcParams['xtick.major.width'] = 4
plt.rcParams['xtick.bottom'] = True
plt.rcParams['ytick.left'] = True
fig, ax = plt.subplots()
plt.show()
In case one wants to not mess with global rcParams, but manually tune by plot, one can use ax.tick_params()
import seaborn as sns
import matplotlib.pyplot as plt
sns.set_style('white', {'axes.linewidth': 0.5})
fig, ax = plt.subplots()
ax.tick_params(bottom=True, left=True)
plt.show()
The critical part is "enabling" the tick marks - in this case the bottom and left marks were enabled. If one wants marks on the four sides, using ax.tick_params(reset=True)
might also be an option, though I'm not sure how this might affect other Seaborn tunings.
There are also a number of options listed in the function documentation that might be useful, although they do not apply directly to OP.
Note: this answer also works for other styles, including the default one, not just 'white'
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With