Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 1 addition & 25 deletions examples/pie_and_polar_charts/pie_demo_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,16 @@
rotated counter-clockwise by 90 degrees, and the frog slice starts on the
positive y-axis.
"""
import numpy as np
import matplotlib.pyplot as plt

# Pie chart, where the slices will be ordered and plotted counter-clockwise:
labels = 'Frogs', 'Hogs', 'Dogs', 'Logs'
sizes = [15, 30, 45, 10]
explode = (0, 0.1, 0, 0) # only "explode" the 2nd slice (i.e. 'Hogs')

fg1, ax1 = plt.subplots()
fig1, ax1 = plt.subplots()
ax1.pie(sizes, explode=explode, labels=labels, autopct='%1.1f%%',
shadow=True, startangle=90)
ax1.axis('equal') # Equal aspect ratio ensures that pie is drawn as a circle.


# Plot four Pie charts in a 2x2 grid:
pie_data = [np.roll(sizes, i) for i in range(4)] # generate some data
pie_centerpos = [(0, 0), (0, 1), (1, 0), (1, 1)] # the grid positions

fg2, ax2 = plt.subplots()
for data, cpos in zip(pie_data, pie_centerpos):
_, txts = ax2.pie(data, explode=explode, shadow=True, startangle=90,
radius=0.35, center=cpos, frame=True, labeldistance=.7)
# Make texts include number and labels:
for t, l, d in zip(txts, labels, data):
t.set_text("%s\n %.1f%%" % (l, d))
t.set_horizontalalignment("center")
t.set_fontsize(8)

ax2.set_xticks([0, 1])
ax2.set_yticks([0, 1])
ax2.set_xticklabels(["Sunny", "Cloudy"])
ax2.set_yticklabels(["Dry", "Rainy"])
ax2.set_xlim((-0.5, 1.5))
ax2.set_ylim((-0.5, 1.5))
ax2.set_aspect('equal') # Equal aspect ratio ensures that the pie is a circle.

plt.show()
4 changes: 2 additions & 2 deletions examples/pylab_examples/scatter_demo2.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
fig, ax = plt.subplots()
ax.scatter(delta1[:-1], delta1[1:], c=close, s=volume, alpha=0.5)

ax.set_xlabel(r'$\Delta_i$', fontsize=20)
ax.set_ylabel(r'$\Delta_{i+1}$', fontsize=20)
ax.set_xlabel(r'$\Delta_i$', fontsize=15)
ax.set_ylabel(r'$\Delta_{i+1}$', fontsize=15)
ax.set_title('Volume and percent change')

ax.grid(True)
Expand Down
2 changes: 1 addition & 1 deletion examples/pylab_examples/simple_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy as np

t = np.arange(0.0, 2.0, 0.01)
s = np.sin(2*np.pi*t)
s = 1 + np.sin(2*np.pi*t)
plt.plot(t, s)

plt.xlabel('time (s)')
Expand Down