Skip to content

Commit

Permalink
small tweaks to size and spacing identified during review
Browse files Browse the repository at this point in the history
  • Loading branch information
jimustafa committed Jan 3, 2022
1 parent 73ced9f commit 1132fc7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions scripts/annotation-connection-styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
pathlib.Path(__file__).parent/'../styles/base.mplstyle',
pathlib.Path(__file__).parent/'../styles/plotlet-grid.mplstyle',
])
mpl.rc('lines', markersize=3)


def demo_con_style(ax, connectionstyle):
Expand All @@ -17,8 +18,8 @@ def demo_con_style(ax, connectionstyle):
ax.annotate("",
xy=(x1, y1), xycoords='data',
xytext=(x2, y2), textcoords='data',
arrowprops=dict(arrowstyle="->", color="0.5",
shrinkA=2, shrinkB=2,
arrowprops=dict(arrowstyle="->", lw=0.5, color="0.5",
shrinkA=3, shrinkB=3,
patchA=None, patchB=None,
connectionstyle=connectionstyle),
)
Expand All @@ -41,4 +42,3 @@ def demo_con_style(ax, connectionstyle):
ax.set(xlim=(0, 1), ylim=(0, 1), xticks=[], yticks=[], aspect=1)

plt.savefig("../figures/annotation-connection-styles.pdf")
# plt.show()
16 changes: 8 additions & 8 deletions scripts/tick-formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25))
ax.xaxis.set_major_formatter(ticker.NullFormatter())
ax.xaxis.set_minor_formatter(ticker.NullFormatter())
ax.text(0.0, 0.1, "ticker.NullFormatter()",
ax.text(0.0, 0.2, "ticker.NullFormatter()",
fontfamily="Source Code Pro", transform=ax.transAxes, in_layout=False)

# Fixed formatter
Expand All @@ -40,47 +40,47 @@
ax.xaxis.set_major_locator(ticker.FixedLocator(range(6)))
majors = ["zero", "one", "two", "three", "four", "five"]
ax.xaxis.set_major_formatter(ticker.FixedFormatter(majors))
ax.text(0.0, 0.1, "ticker.FixedFormatter(['zero', 'one', 'two', …])",
ax.text(0.0, 0.2, "ticker.FixedFormatter(['zero', 'one', 'two', …])",
fontfamily="Source Code Pro", transform=ax.transAxes, in_layout=False)

# FuncFormatter formatter
ax = axs[2]
ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00))
ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25))
ax.xaxis.set_major_formatter(ticker.FuncFormatter(lambda x, pos: "[%.2f]" % x))
ax.text(0.0, 0.1, 'ticker.FuncFormatter(lambda x, pos: "[%.2f]" % x)',
ax.text(0.0, 0.2, 'ticker.FuncFormatter(lambda x, pos: "[%.2f]" % x)',
fontfamily="Source Code Pro", transform=ax.transAxes, in_layout=False)

# FormatStr formatter
ax = axs[3]
ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00))
ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25))
ax.xaxis.set_major_formatter(ticker.FormatStrFormatter(">%d<"))
ax.text(0.0, 0.1, "ticker.FormatStrFormatter('>%d<')",
ax.text(0.0, 0.2, "ticker.FormatStrFormatter('>%d<')",
fontfamily="Source Code Pro", transform=ax.transAxes, in_layout=False)

# Scalar formatter
ax = axs[4]
ax.xaxis.set_major_locator(ticker.AutoLocator())
ax.xaxis.set_minor_locator(ticker.AutoMinorLocator())
ax.xaxis.set_major_formatter(ticker.ScalarFormatter(useMathText=True))
ax.text(0.0, 0.1, "ticker.ScalarFormatter()",
ax.text(0.0, 0.2, "ticker.ScalarFormatter()",
fontfamily="Source Code Pro", transform=ax.transAxes, in_layout=False)

# StrMethod formatter
ax = axs[5]
ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00))
ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25))
ax.xaxis.set_major_formatter(ticker.StrMethodFormatter("{x}"))
ax.text(0.0, 0.1, "ticker.StrMethodFormatter('{x}')",
ax.text(0.0, 0.2, "ticker.StrMethodFormatter('{x}')",
fontfamily="Source Code Pro", transform=ax.transAxes, in_layout=False)

# Percent formatter
ax = axs[6]
ax.xaxis.set_major_locator(ticker.MultipleLocator(1.00))
ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.25))
ax.xaxis.set_major_formatter(ticker.PercentFormatter(xmax=5))
ax.text(0.0, 0.1, "ticker.PercentFormatter(xmax=5)",
ax.text(0.0, 0.2, "ticker.PercentFormatter(xmax=5)",
fontfamily="Source Code Pro", transform=ax.transAxes, in_layout=False)

plt.savefig("../figures/tick-formatters.pdf")
fig.savefig("../figures/tick-formatters.pdf")
18 changes: 9 additions & 9 deletions scripts/tick-locators.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
ax = axs[0]
ax.xaxis.set_major_locator(ticker.NullLocator())
ax.xaxis.set_minor_locator(ticker.NullLocator())
ax.text(0.0, 0.1, "ticker.NullLocator()",
ax.text(0.0, 0.2, "ticker.NullLocator()",
fontfamily='Source Code Pro', transform=ax.transAxes, in_layout=False)

# Multiple Locator
ax = axs[1]
ax.xaxis.set_major_locator(ticker.MultipleLocator(0.5))
ax.xaxis.set_minor_locator(ticker.MultipleLocator(0.1))
ax.text(0.0, 0.1, "ticker.MultipleLocator(0.5)",
ax.text(0.0, 0.2, "ticker.MultipleLocator(0.5)",
fontfamily='Source Code Pro', transform=ax.transAxes, in_layout=False)

# Fixed Locator
Expand All @@ -45,43 +45,43 @@
ax.xaxis.set_major_locator(ticker.FixedLocator(majors))
minors = np.linspace(0, 1, 11)[1:-1]
ax.xaxis.set_minor_locator(ticker.FixedLocator(minors))
ax.text(0.0, 0.1, "ticker.FixedLocator([0, 1, 5])",
ax.text(0.0, 0.2, "ticker.FixedLocator([0, 1, 5])",
fontfamily='Source Code Pro', transform=ax.transAxes, in_layout=False)

# Linear Locator
ax = axs[3]
ax.xaxis.set_major_locator(ticker.LinearLocator(3))
ax.xaxis.set_minor_locator(ticker.LinearLocator(31))
ax.text(0.0, 0.1, "ticker.LinearLocator(numticks=3)",
ax.text(0.0, 0.2, "ticker.LinearLocator(numticks=3)",
fontfamily='Source Code Pro', transform=ax.transAxes, in_layout=False)

# Index Locator
ax = axs[4]
ax.plot(range(0, 5), [0]*5, color='white')
ax.xaxis.set_major_locator(ticker.IndexLocator(base=.5, offset=.25))
ax.text(0.0, 0.1, "ticker.IndexLocator(base=0.5, offset=0.25)",
ax.text(0.0, 0.2, "ticker.IndexLocator(base=0.5, offset=0.25)",
fontfamily='Source Code Pro', transform=ax.transAxes, in_layout=False)

# Auto Locator
ax = axs[5]
ax.xaxis.set_major_locator(ticker.AutoLocator())
ax.xaxis.set_minor_locator(ticker.AutoMinorLocator())
ax.text(0.0, 0.1, "ticker.AutoLocator()",
ax.text(0.0, 0.2, "ticker.AutoLocator()",
fontfamily='Source Code Pro', transform=ax.transAxes, in_layout=False)

# MaxN Locator
ax = axs[6]
ax.xaxis.set_major_locator(ticker.MaxNLocator(4))
ax.xaxis.set_minor_locator(ticker.MaxNLocator(40))
ax.text(0.0, 0.1, "ticker.MaxNLocator(n=4)",
ax.text(0.0, 0.2, "ticker.MaxNLocator(n=4)",
fontfamily='Source Code Pro', transform=ax.transAxes, in_layout=False)

# Log Locator
ax = axs[7]
ax.set_xlim(10**3, 10**10)
ax.set_xscale('log')
ax.xaxis.set_major_locator(ticker.LogLocator(base=10.0, numticks=15))
ax.text(0.0, 0.1, "ticker.LogLocator(base=10, numticks=15)",
ax.text(0.0, 0.2, "ticker.LogLocator(base=10, numticks=15)",
fontfamily='Source Code Pro', transform=ax.transAxes, in_layout=False)

plt.savefig("../figures/tick-locators.pdf")
fig.savefig("../figures/tick-locators.pdf")

0 comments on commit 1132fc7

Please sign in to comment.