FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

SWR matplotlib__matplotlib-8983 by richeshgupta · Pull Request #149 · razorpaytest/matplotlib · GitHub

SWR matplotlib__matplotlib-8983 by richeshgupta · Pull Request #149 · razorpaytest/matplotlib · GitHub
Skip to content

Navigation Menu

Repository navigation

Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (47) .rst  (2) .txt  (1) All 3 file types selected
Deleted files Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
2 changes: 1 addition & 1 deletion doc/faq/howto_faq.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ and patches, respectively::

.. htmlonly::

See :ref:`sphx_glr_gallery_pylab_examples_zorder_demo.py` for a complete example.
See :ref:`sphx_glr_gallery_misc_zorder_demo.py` for a complete example.

You can also use the Axes property
:meth:`~matplotlib.axes.Axes.set_axisbelow` to control whether the grid
Expand Down
8 changes: 4 additions & 4 deletions doc/users/prev_whats_new/whats_new_1.3.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ New eventplot plot type
Todd Jennings added a :func:`~matplotlib.pyplot.eventplot` function to
create multiple rows or columns of identical line segments

.. figure:: ../../gallery/pylab_examples/images/sphx_glr_eventplot_demo_001.png
:target: ../../gallery/pylab_examples/eventplot_demo.html
.. figure:: ../../gallery/lines_bars_and_markers/images/sphx_glr_eventplot_demo_001.png
:target: ../../gallery/lines_bars_and_markers/eventplot_demo.html
:align: center
:scale: 50

Expand Down Expand Up @@ -199,8 +199,8 @@ Path effects on lines
`````````````````````
Thanks to Jae-Joon Lee, path effects now also work on plot lines.

.. figure:: ../../gallery/pylab_examples/images/sphx_glr_patheffect_demo_001.png
:target: ../../gallery/pylab_examples/patheffect_demo.html
.. figure:: ../../gallery/misc/images/sphx_glr_patheffect_demo_001.png
:target: ../../gallery/misc/patheffect_demo.html
:align: center
:scale: 50

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def tellme(s):
##################################################
# Define a triangle by clicking three points


plt.clf()
plt.axis([-1., 1., -1., 1.])
plt.setp(plt.gca(), autoscale_on=False)
Expand Down Expand Up @@ -73,6 +74,7 @@ def f(x, y, pts):
z = z + 1/(np.sqrt((x - p[0])**2 + (y - p[1])**2))
return 1/z


X, Y = np.meshgrid(np.linspace(-1, 1, 51), np.linspace(-1, 1, 51))
Z = f(X, Y, pts)

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
not m.startswith(('spectral', 'Vega')) # Skip deprecated colormaps.
)

#fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99)
# fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99)

ncol = 2
nrow = len(maps)//ncol + 1
Expand All @@ -50,7 +50,7 @@

for i, m in enumerate(maps):
ix, iy = divmod(i, nrow)
#plt.figimage(a, 10, i*10, cmap=plt.get_cmap(m), origin='lower')
# plt.figimage(a, 10, i*10, cmap=plt.get_cmap(m), origin='lower')
bbox0 = Bbox.from_bounds(ix*dx*(1 + xpad_fraction),
1. - iy*dy*(1 + ypad_fraction) - dy,
dx, dy)
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
ax.append(fig1.add_subplot(gs[row, col]))
ax[-1].set_title('markevery=%s' % str(case))
ax[-1].plot(x, y, 'o', ls='-', ms=4, markevery=case)
#fig1.tight_layout()

###############################################################################
# Plot each markevery case for log x and y scales
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@
plt.ylabel('more nans')
plt.grid(True)

plt.tight_layout()
plt.show()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
Cross- and Auto-Correlation Demo
================================

Example use of cross-correlation (``xcorr``) and auto-correlation (``acorr``) plots.
Example use of cross-correlation (`xcorr`) and auto-correlation (`acorr`)
plots.
"""
import matplotlib.pyplot as plt
import numpy as np
Expand All @@ -14,13 +15,11 @@


x, y = np.random.randn(2, 100)
fig = plt.figure()
ax1 = fig.add_subplot(211)
fig, [ax1, ax2] = plt.subplots(2, 1, sharex=True)
ax1.xcorr(x, y, usevlines=True, maxlags=50, normed=True, lw=2)
ax1.grid(True)
ax1.axhline(0, color='black', lw=2)

ax2 = fig.add_subplot(212, sharex=ax1)
ax2.acorr(x, usevlines=True, normed=True, maxlags=50, lw=2)
ax2.grid(True)
ax2.axhline(0, color='black', lw=2)
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@


class AnchoredText(AnchoredOffsetbox):
def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True):
def __init__(self, s, loc, pad=0.4, borderpad=0.5,
prop=None, frameon=True):

self.txt = TextArea(s,
minimumdescent=False)
Expand All @@ -26,8 +27,8 @@ class AnchoredSizeBar(AnchoredOffsetbox):
def __init__(self, transform, size, label, loc,
pad=0.1, borderpad=0.1, sep=2, prop=None, frameon=True):
"""
Draw a horizontal bar with the size in data coordinate of the give axes.
A label will be drawn underneath (center-aligned).
Draw a horizontal bar with the size in data coordinate of the given
axes. A label will be drawn underneath (center-aligned).

pad, borderpad in fraction of the legend font size (or prop)
sep in points.
Expand Down Expand Up @@ -71,7 +72,8 @@ def __init__(self, width, height, xdescent, ydescent,

self.da = DrawingArea(width, height, xdescent, ydescent)

super(AnchoredDrawingArea, self).__init__(loc, pad=pad, borderpad=borderpad,
super(AnchoredDrawingArea, self).__init__(loc, pad=pad,
borderpad=borderpad,
child=self.da,
prop=None,
frameon=frameon)
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
def millions(x):
return '$%1.1fM' % (x*1e-6)


# Fixing random state for reproducibility
np.random.seed(19680801)

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ def mouse_move(self, event):
plt.draw()

t = np.arange(0.0, 1.0, 0.01)
s = np.sin(2*2*np.pi*t)
s = np.sin(2 * 2 * np.pi * t)
fig, ax = plt.subplots()

#cursor = Cursor(ax)
# cursor = Cursor(ax)
cursor = SnaptoCursor(ax, t, s)
plt.connect('motion_notify_event', cursor.mouse_move)

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
def set_pub():
rc('font', weight='bold') # bold fonts are easier to see
rc('tick', labelsize=15) # tick labels bigger
rc('lines', lw=1, color='k') # thicker black lines (no budget for color!)
rc('lines', lw=1, color='k') # thicker black lines
rc('grid', c='0.5', ls='-', lw=0.5) # solid gray grid lines
rc('savefig', dpi=300) # higher res outputs

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.transforms as mtransforms
from matplotlib.colors import LightSource
from matplotlib.artist import Artist


def smooth1d(x, window_len):
Expand All @@ -34,7 +37,7 @@ def smooth2d(A, sigma=3):
class BaseFilter(object):
def prepare_image(self, src_image, dpi, pad):
ny, nx, depth = src_image.shape
#tgt_image = np.zeros([pad*2+ny, pad*2+nx, depth], dtype="d")
# tgt_image = np.zeros([pad*2+ny, pad*2+nx, depth], dtype="d")
padded_src = np.zeros([pad*2 + ny, pad*2 + nx, depth], dtype="d")
padded_src[pad:-pad, pad:-pad, :] = src_image[:, :, :]

Expand Down Expand Up @@ -82,7 +85,7 @@ def get_pad(self, dpi):
return int(self.sigma*3/72.*dpi)

def process_image(self, padded_src, dpi):
#offsetx, offsety = int(self.offsets[0]), int(self.offsets[1])
# offsetx, offsety = int(self.offsets[0]), int(self.offsets[1])
tgt_image = np.zeros_like(padded_src)
aa = smooth2d(padded_src[:, :, -1]*self.alpha,
self.sigma/72.*dpi)
Expand All @@ -106,9 +109,6 @@ def process_image(self, padded_src, dpi):
return t2


from matplotlib.colors import LightSource


class LightFilter(BaseFilter):
"simple gauss filter"

Expand Down Expand Up @@ -160,9 +160,6 @@ def __call__(self, im, dpi):
return new_im, offsetx, offsety


from matplotlib.artist import Artist


class FilteredArtistList(Artist):
"""
A simple container to draw filtered artist.
Expand All @@ -182,9 +179,6 @@ def draw(self, renderer):
renderer.stop_rasterizing()


import matplotlib.transforms as mtransforms


def filtered_text(ax):
# mostly copied from contour_demo.py

Expand Down Expand Up @@ -281,9 +275,10 @@ def drop_shadow_patches(ax):
rects1 = ax.bar(ind, menMeans, width, color='r', ec="w", lw=2)

womenMeans = (25, 32, 34, 20, 25)
rects2 = ax.bar(ind + width + 0.1, womenMeans, width, color='y', ec="w", lw=2)
rects2 = ax.bar(ind + width + 0.1, womenMeans, width,
color='y', ec="w", lw=2)

#gauss = GaussianFilter(1.5, offsets=(1,1), )
# gauss = GaussianFilter(1.5, offsets=(1,1), )
gauss = DropShadowFilter(5, offsets=(1, 1), )
shadow = FilteredArtistList(rects1 + rects2, gauss)
ax.add_artist(shadow)
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
def myfunc(x):
return hasattr(x, 'set_color') and not hasattr(x, 'set_facecolor')


for o in fig.findobj(myfunc):
o.set_color('blue')

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
txt = ax1.annotate("test", (1., 1.), (0., 0),
arrowprops=dict(arrowstyle="->",
connectionstyle="angle3", lw=2),
size=20, ha="center", path_effects=[PathEffects.withStroke(linewidth=3,
foreground="w")])
size=20, ha="center",
path_effects=[PathEffects.withStroke(linewidth=3,
foreground="w")])
txt.arrow_patch.set_path_effects([
PathEffects.Stroke(linewidth=5, foreground="w"),
PathEffects.Normal()])
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
# offset_copy works for polar plots also.
ax = plt.subplot(2, 1, 2, projection='polar')

trans_offset = mtransforms.offset_copy(ax.transData, fig=fig, y=6, units='dots')
trans_offset = mtransforms.offset_copy(ax.transData, fig=fig,
y=6, units='dots')

for x, y in zip(xs, ys):
plt.polar((x,), (y,), 'ro')
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ def make_fig():

FigureCanvasAgg(fig).print_png('webapp.png', dpi=150)


make_fig()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@

x = np.linspace(0, 2*np.pi, 100)
plt.figure()
plt.plot(x, np.sin(x), linewidth=10, color='black', label='zorder=10', zorder=10) # on top
plt.plot(x, np.cos(1.3*x), linewidth=10, color='red', label='zorder=1', zorder=1) # bottom
plt.plot(x, np.sin(2.1*x), linewidth=10, color='green', label='zorder=3', zorder=3)
plt.axhline(0, linewidth=10, color='blue', label='zorder=2', zorder=2)
plt.plot(x, np.sin(x), linewidth=10, color='black', label='zorder=10',
zorder=10) # on top
plt.plot(x, np.cos(1.3*x), linewidth=10, color='red', label='zorder=1',
zorder=1) # bottom
plt.plot(x, np.sin(2.1*x), linewidth=10, color='green', label='zorder=3',
zorder=3)
plt.axhline(0, linewidth=10, color='blue', label='zorder=2',
zorder=2)
plt.title('Custom order of elements')
l = plt.legend()
l.set_zorder(20) # put the legend on top
Expand Down
4 changes: 0 additions & 4 deletions examples/pylab_examples/README.txt

This file was deleted.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,5 @@
plt.grid(True)
plt.ylabel('symlog both')

plt.subplots_adjust(hspace=0.5, left=0.2)

plt.tight_layout()
plt.show()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@
fig = plt.figure()
ax1 = fig.add_subplot(131)
ax1.bar(range(1, 5), range(1, 5), color='red', edgecolor='black', hatch="/")
ax1.bar(range(1, 5), [6] * 4, bottom=range(1, 5), color='blue', edgecolor='black', hatch='//')
ax1.bar(range(1, 5), [6] * 4, bottom=range(1, 5),
color='blue', edgecolor='black', hatch='//')
ax1.set_xticks([1.5, 2.5, 3.5, 4.5])

ax2 = fig.add_subplot(132)
bars = ax2.bar(range(1, 5), range(1, 5), color='yellow', ecolor='black') + \
ax2.bar(range(1, 5), [6] * 4, bottom=range(1, 5), color='green', ecolor='black')
ax2.bar(range(1, 5), [6] * 4, bottom=range(1, 5),
color='green', ecolor='black')
ax2.set_xticks([1.5, 2.5, 3.5, 4.5])

patterns = ('-', '+', 'x', '\\', '*', 'o', 'O', '.')
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def draw(self, renderer=None):
p = PathClippedImagePatch(text_path, arr, ec="k",
transform=IdentityTransform())

#p.set_clip_on(False)
# p.set_clip_on(False)

# make offset box
offsetbox = AuxTransformBox(IdentityTransform())
Expand Down Expand Up @@ -122,15 +122,18 @@ def draw(self, renderer=None):
arr = np.arange(256).reshape(1, 256)/256.

if usetex:
s = r"$\displaystyle\left[\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}\right]$!"
s = (r"$\displaystyle\left[\sum_{n=1}^\infty"
r"\frac{-e^{i\pi}}{2^n}\right]$!")
else:
s = r"$\left[\sum_{n=1}^\infty\frac{-e^{i\pi}}{2^n}\right]$!"
text_path = TextPath((0, 0), s, size=40, usetex=usetex)
text_patch = PathClippedImagePatch(text_path, arr, ec="none",
transform=IdentityTransform())

shadow1 = mpatches.Shadow(text_patch, 1, -1, props=dict(fc="none", ec="0.6", lw=3))
shadow2 = mpatches.Shadow(text_patch, 1, -1, props=dict(fc="0.3", ec="none"))
shadow1 = mpatches.Shadow(text_patch, 1, -1,
props=dict(fc="none", ec="0.6", lw=3))
shadow2 = mpatches.Shadow(text_patch, 1, -1,
props=dict(fc="0.3", ec="none"))

# make offset box
offsetbox = AuxTransformBox(IdentityTransform())
Expand All @@ -144,7 +147,7 @@ def draw(self, renderer=None):
boxcoords="offset points",
box_alignment=(0.5, 0.5),
)
#text_path.set_size(10)
# text_path.set_size(10)

ax.add_artist(ab)

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/axes/_axes.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1,
Examples
--------

.. plot:: mpl_examples/pylab_examples/eventplot_demo.py
.. plot:: mpl_examples/lines_bars_and_markers/eventplot_demo.py
"""
self._process_unit_info(xdata=positions,
ydata=[lineoffsets, linelengths],
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/collections.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,7 @@ def __init__(self,
Examples
--------

.. plot:: mpl_examples/pylab_examples/eventcollection_demo.py
.. plot:: mpl_examples/lines_bars_and_markers/eventcollection_demo.py
"""

segment = (lineoffset + linelength / 2.,
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/dates.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ class bytespdate2num(strpdate2num):
"""
Use this class to parse date strings to matplotlib datenums when
you know the date format string of the date you are parsing. See
:file:`examples/pylab_examples/load_converter.py`.
:file:`examples/misc/load_converter.py`.
"""
def __init__(self, fmt, encoding='utf-8'):
"""
Expand Down

Footer

© 2026 GitHub, Inc.

Back | FazBrowse Home | New Git URL