Python
Re: Python
atimsina wrote:How to plot many chart in same page using subplot code?
It depends on your plot command. If you are using normal plot, you can add subplot and plot inside them. Here is one example I found.
If you can post one line of your code which plots I may be able to find appropriate way to do that.
Code: Select all
Examples illustrating the use of plt.subplots().
This function creates a figure and a grid of subplots with a single call, while
providing reasonable control over how the individual plots are created. For
very refined tuning of subplot creation, you can still use add_subplot()
directly on a new figure.
"""
import matplotlib.pyplot as plt
import numpy as np
# Simple data to display in various forms
x = np.linspace(0, 2 * np.pi, 400)
y = np.sin(x ** 2)
plt.close('all')
# Just a figure and one subplot
[color=#FF0000]f, ax = plt.subplots()[/color]
[color=#FF0000]ax.plot(x, y)[/color]
ax.set_title('Simple plot')
# Two subplots, the axes array is 1-d
[color=#FF0000]f, axarr = plt.subplots(2, sharex=True)[/color][color=#FF0000]
axarr[0].plot(x, y)[/color]
axarr[0].set_title('Sharing X axis')
axarr[1].scatter(x, y)
# Two subplots, unpack the axes array immediately
f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
ax1.plot(x, y)
ax1.set_title('Sharing Y axis')
ax2.scatter(x, y)
# Three subplots sharing both x/y axes
f, (ax1, ax2, ax3) = plt.subplots(3, sharex=True, sharey=True)
ax1.plot(x, y)
ax1.set_title('Sharing both axes')
ax2.scatter(x, y)
ax3.scatter(x, 2 * y ** 2 - 1, color='r')
# Fine-tune figure; make subplots close to each other and hide x ticks for
# all but bottom plot.
f.subplots_adjust(hspace=0)
plt.setp([a.get_xticklabels() for a in f.axes[:-1]], visible=False)
# row and column sharing
f, ((ax1, ax2), (ax3, ax4)) = plt.subplots(2, 2, sharex='col', sharey='row')
ax1.plot(x, y)
ax1.set_title('Sharing x per column, y per row')
ax2.scatter(x, y)
ax3.scatter(x, 2 * y ** 2 - 1, color='r')
ax4.plot(x, 2 * y ** 2 - 1, color='r')
# Four axes, returned as a 2-d array
f, axarr = plt.subplots(2, 2)
axarr[0, 0].plot(x, y)
axarr[0, 0].set_title('Axis [0,0]')
axarr[0, 1].scatter(x, y)
axarr[0, 1].set_title('Axis [0,1]')
axarr[1, 0].plot(x, y ** 2)
axarr[1, 0].set_title('Axis [1,0]')
axarr[1, 1].scatter(x, y ** 2)
axarr[1, 1].set_title('Axis [1,1]')
# Fine-tune figure; hide x ticks for top plots and y ticks for right plots
plt.setp([a.get_xticklabels() for a in axarr[0, :]], visible=False)
plt.setp([a.get_yticklabels() for a in axarr[:, 1]], visible=False)
# Four polar axes
f, axarr = plt.subplots(2, 2, subplot_kw=dict(projection='polar'))
axarr[0, 0].plot(x, y)
axarr[0, 0].set_title('Axis [0,0]')
axarr[0, 1].scatter(x, y)
axarr[0, 1].set_title('Axis [0,1]')
axarr[1, 0].plot(x, y ** 2)
axarr[1, 0].set_title('Axis [1,0]')
axarr[1, 1].scatter(x, y ** 2)
axarr[1, 1].set_title('Axis [1,1]')
# Fine-tune figure; make subplots farther from each other.
f.subplots_adjust(hspace=0.3)
plt.show()
http://matplotlib.org/examples/pylab_examples/subplots_demo.html
Re: Python
Very nice collection for plotting in python.
matplotlib is a collection of plotting functions which resemble Matlab plot methods.
In this address you will find a very helpful tutorial:
http://matplotlib.org/users/pyplot_tutorial.html
matplotlib is a collection of plotting functions which resemble Matlab plot methods.
In this address you will find a very helpful tutorial:
http://matplotlib.org/users/pyplot_tutorial.html
Re: Python
This is a very nice and interactive and free course for Python, It is called Python for data sciences:
You even don't need to register, Just click and enjoy ! Thank you DataCamp !
https://www.datacamp.com/courses/intro-to-python-for-data-science?utm_source=fb_paid&utm_medium=fb_desktop&utm_campaign=dc_visitors
You even don't need to register, Just click and enjoy ! Thank you DataCamp !
https://www.datacamp.com/courses/intro-to-python-for-data-science?utm_source=fb_paid&utm_medium=fb_desktop&utm_campaign=dc_visitors
Re: Python
Nice course for beginners:
MIT open course: Introduction to Computer Science and Programming in Python
Instructor(s):
Dr. Ana Bell
Prof. Eric Grimson
Prof. John Guttag
Link
MIT open course: Introduction to Computer Science and Programming in Python
Instructor(s):
Dr. Ana Bell
Prof. Eric Grimson
Prof. John Guttag
Link
Re: Python
Intro to Python for Data Science
https://www.datacamp.com/courses/intro-to-python-for-data-science
Intermediate Python for Data Science
https://www.datacamp.com/courses/intermediate-python-for-data-science
Introduction to Data Visualization with Python
https://www.datacamp.com/courses/introduction-to-data-visualization-with-python
https://www.datacamp.com/courses/intro-to-python-for-data-science
Intermediate Python for Data Science
https://www.datacamp.com/courses/intermediate-python-for-data-science
Introduction to Data Visualization with Python
https://www.datacamp.com/courses/introduction-to-data-visualization-with-python
Return to “Programming and Linux”
Who is online
Users browsing this forum: No registered users and 1 guest