10

I want to plot some (x,y) points on the same graph and I don't need any special features at all short of support for polar coordinates which would be nice but not necessary. It's mostly for visualizing my data. Is there a simple way to do this? Matplotlib seems like way more than I need right now. Are there any more basic modules available? What do You recommend?

1
  • 1
    matplotlib is the way.. for plotting points you need just 2 lines, and then you have the possibility to easily make more complex stuff with the same tool :) Commented Jul 25, 2011 at 17:04

8 Answers 8

23

Go with matplotlib Chance is that sometime in the future you might need to do more than just "simple" stuff and then you don't need to invest time learning a new plot-tool.

See this link for list of plotting tools for python...

Sign up to request clarification or add additional context in comments.

Comments

15

Absolutely. Matplotlib is the way to go.

The pyplot module provides a nice interface to get simple plots up and running fast, especially if you are familiar with MatLab's plotting environment. Here is a simple example using pyplot:

import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
x_points = xrange(0,9)
y_points = xrange(0,9)
p = ax.plot(x_points, y_points, 'b')
ax.set_xlabel('x-points')
ax.set_ylabel('y-points')
ax.set_title('Simple XY point plot')
fig.show()

Comments

4
import matplotlib.pyplot as plt 
x = range(1,10) 
y = range(1,10) 
plt.plot(x,y,'o')
plt.show()

Here's a simple line with made up x, y. Note: x and y are lists.

Their lengths should be equal or you'll get a error. Cheers!

Comments

3

I suggest the most good looking plotting library for Python: CairoPlot

Comments

2

You can use the Tkinter canvas widget. It uses rectangular coordinates but of course you can translate to polar. The canvas is pretty much just like it sounds -- a blank canvas on which you can draw points, lines, circles, rectangles, etc.

Comments

1

You could always write a plotting function that uses the turtle module from the standard library.

Comments

1

MathGL is GPL plotting library which have Python interface, arbitrary (including polar) curved coordinates, a lot of plot types, export to PNG, EPS, SVG, widgets, and so on. For 1D plot samples see here.

Comments

0

Have you tried to use pillow?

   from PIL import Image, ImageDraw

   #Set up canvas
   img = Image.new (mode, size)
   draw = ImageDraw.Draw (img)

   #Draw your points
   draw.point (xy, colour) 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.