Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 04051bd

Browse filesBrowse files
authored
Merge pull request #23377 from QuLogic/more-tick_params
Use tick_params more often over tick iteration
2 parents 297feee + e421dd5 commit 04051bd
Copy full SHA for 04051bd

File tree

Expand file treeCollapse file tree

5 files changed

+6
-22
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+6
-22
lines changed

‎examples/axes_grid1/demo_axes_rgb.py

Copy file name to clipboardExpand all lines: examples/axes_grid1/demo_axes_rgb.py
+1-4Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,8 @@ def demo_rgb2():
5959
ax_b.imshow(im_b)
6060

6161
for ax in fig.axes:
62-
ax.tick_params(axis='both', direction='in')
62+
ax.tick_params(direction='in', color='w')
6363
ax.spines[:].set_color("w")
64-
for tick in ax.xaxis.get_major_ticks() + ax.yaxis.get_major_ticks():
65-
tick.tick1line.set_markeredgecolor("w")
66-
tick.tick2line.set_markeredgecolor("w")
6764

6865

6966
demo_rgb1()

‎examples/images_contours_and_fields/image_masked.py

Copy file name to clipboardExpand all lines: examples/images_contours_and_fields/image_masked.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@
5050
ax1.set_title('Green=low, Red=high, Blue=masked')
5151
cbar = fig.colorbar(im, extend='both', shrink=0.9, ax=ax1)
5252
cbar.set_label('uniform')
53-
for ticklabel in ax1.xaxis.get_ticklabels():
54-
ticklabel.set_visible(False)
53+
ax1.tick_params(axis='x', labelbottom=False)
5554

5655
# Plot using a small number of colors, with unevenly spaced boundaries.
5756
im = ax2.imshow(Zm, interpolation='nearest',

‎examples/lines_bars_and_markers/fill_between_alpha.py

Copy file name to clipboardExpand all lines: examples/lines_bars_and_markers/fill_between_alpha.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,9 @@
3030

3131
for ax in ax1, ax2:
3232
ax.grid(True)
33+
ax.label_outer()
3334

3435
ax1.set_ylabel('price')
35-
for label in ax2.get_yticklabels():
36-
label.set_visible(False)
3736

3837
fig.suptitle('Google (GOOG) daily closing price')
3938
fig.autofmt_xdate()

‎examples/pyplots/fig_axes_customize_simple.py

Copy file name to clipboardExpand all lines: examples/pyplots/fig_axes_customize_simple.py
+2-12Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,8 @@
1919
rect = ax1.patch
2020
rect.set_facecolor('lightslategray')
2121

22-
23-
for label in ax1.xaxis.get_ticklabels():
24-
# label is a Text instance
25-
label.set_color('tab:red')
26-
label.set_rotation(45)
27-
label.set_fontsize(16)
28-
29-
for line in ax1.yaxis.get_ticklines():
30-
# line is a Line2D instance
31-
line.set_markeredgecolor('tab:green')
32-
line.set_markersize(25)
33-
line.set_markeredgewidth(3)
22+
ax1.tick_params(axis='x', labelcolor='tab:red', labelrotation=45, labelsize=16)
23+
ax1.tick_params(axis='y', color='tab:green', size=25, width=3)
3424

3525
plt.show()
3626

‎examples/subplots_axes_and_figures/align_labels_demo.py

Copy file name to clipboardExpand all lines: examples/subplots_axes_and_figures/align_labels_demo.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@
3030
ax.set_ylabel('YLabel1 %d' % i)
3131
ax.set_xlabel('XLabel1 %d' % i)
3232
if i == 0:
33-
for tick in ax.get_xticklabels():
34-
tick.set_rotation(55)
33+
ax.tick_params(axis='x', rotation=55)
3534
fig.align_labels() # same as fig.align_xlabels(); fig.align_ylabels()
3635

3736
plt.show()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.