Take the 2-minute tour ×

I would like to be able to have a user drag points across an XY-plane, resulting in a histogram (in Python 3.3).

Consider the following picture, in which the red shows the motion the mouse made (start of arrow is the CLICK, end of the arrow is when the user LETS GO):

Is there any package this could be accomplished in, or do you consider would be of great help? The goal is to be able to create a discrete histogram having this shape.

I guess what I need is to be able to record a dragged path?

enter image description here

share|improve this question
What is the actual problem you want to solve? I can't tell from your description: do you want to plot the y-value of your freehand curve at a specified set of x points? And if so, why does it have to be a curve created with a mouse and computer terminal? That problem was solved long ago with "mouse gesture" code, the precursor of touchscreen 'swipe' code. You may want to move this question to some topical group on XML code or mouse driver code. –  Carl Witthoft Apr 17 '13 at 17:14
You're close indeed. I want to have 1000 X and Y combinations in the end, and the user to see those points connected. Problem is if someone has to set them all individually... Hence the question. Why XML code? –  PascalvKooten Apr 17 '13 at 17:52
Well, then, sounds like you need to track down 'mouse gesture' code. Alternatively, a kludge would be: 1) draw freehand curves in any graphics app (Powerpoint, Paint, Gimp, etc.). 2) load the image into data-extracting tools such as DataThief or EngaugeDigitizer and let the app calculate the coordinates. –  Carl Witthoft Apr 17 '13 at 18:43

2 Answers 2

In R you can use locator() to register left mouse clicks on the current device. You could take these locations and build the histogram from this. I'm quite sure this will only works with discrete clicks, not a smooth dragging motion. See ?locator() for more details about this function.

share|improve this answer
Since I am aiming for around a 1000 points, I really need the "smooth dragging motion". No ideas for it? –  PascalvKooten Apr 17 '13 at 14:18


Is a Python wrapper for the Google Chart API. Just take a look at the Documentation.

Especially check the Examples from the github https://github.com/gak/pygooglechart/tree/master/examples

share|improve this answer
In no example can I find the option to drag the points within a graph. –  PascalvKooten Apr 17 '13 at 14:17

Your Answer


