python - Plotting an interactive line graph with a moving window - looking for advice -


hi plan plot data this:

variable  |  hour 1  |  hour 2  |  hour 3 x         |  80      |  60      |  90 y         |  45      |  50      |  20 z         |  65      |  65      |  35 

basically i'm expecting line graph point marked each hour each variable. here need able draw window (rectangle) on graph, selecting small region of graph. window thicken complete line line runs through window i.e. between threshold on y-axis.

here quick image made of idea:

enter image description here

so haven't started coding yet , seems simple idea wanted advice of more experienced. know c/c++/python/matlab, , thinking matlab simple solution, python preferred language quick , more simple (using matplotlib library perhaps), other code in python.

thanks!

that should pretty easy in both matlab , python/matplotlib. matlab solution (untested):

%assume x , y data in cell arrays, can of different lengths  line_handles = plot(x{1}, y{1}, x{2}, y{2}, x{3}, y{3});  rect = getrect; %select rectangle mouse  = 1:length(line_handles)     if your_intersection_test(rect, x{i}, y{i})         set(line_handles(i), 'linewidth', 5)     end end 

where leave figure out how test if line crosses rectangle (googling 'test if line intersects rectangle' gives useful results, in case poly-line). python solution should similar,matplotlib.widgets.rectangleselector might useful getting rectangle mouse, have never used that. rest of code should translate 1 1 matlab python.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -