[Matplotlib-users] Interactive selecting a quadrilateral from a axes
Hi, I have a plot of an image of which I'd like to interactively select a quadrilateral. This is for a homography operation (perspective correction). It suffices if the quadrilateral can be dragged by only its vertices (display the vertices as rects or circled to click within). In principle I want to implement a tool similar to the "Perspective" tool of The GIMP in corrective mode. The whole image processing and geometric transformation is already implemented, but now I need a user interface. Since I'm already making heavy use of Matplotlib I'd like to stay within this. After the user applied the homography the next step is placing the calibration markers, which would be basically one axvline and two axhlines to be dragged to reference points on the previously perspective corrected image. How do I implement such interaction elements? Wolfgang -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Errorbars not drawn correctly in logarithmic scales
On Mon, 12 Mar 2012 15:51:15 -0500 Benjamin Root wrote: > Ah, finally figured it out. The issue is that your y-value for that > error bar is 9.114, but you want to plot error bars that are > +/-10.31. That line gets thrown out by matplotlib because you can't > plot at negative values for log scale. Yes, I came to the same conclusion. I think matplotlib should print some warning or raise some exception if confronted with data like that, it can't handle. > There is a trick that might > work. The set_yscale method has a kwarg "nonposy" which could be set > to "clip". You could also try setting to the "symlog" scale which > might let you get away with a negative value. I'll try that. Thanks Wolfgang -- This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Errorbars not drawn correctly in logarithmic scales
On Fri, 9 Mar 2012 11:19:15 -0600 Benjamin Root wrote: > Can I have the data you used to produce these errorbars so I can test > this bug? Here's the data # Fluence -sigma Signal... -sigma area 1127 48.32 9.114 10.31 0.1318 1.127e+04 482.9 35.96 16.15 0.4994 1.127e+05 4829 231.2 101.1 2.568 1.127e+06 4.829e+04 4631 1689 12.22 And here's the ploting tool source code (also used for generating the linked PDF). #!/usr/bin/env python2 # -*- coding: utf-8 -*- # vim: filetype python import sys, os, argparse import math, numpy, scipy, scipy.optimize import matplotlib, matplotlib.cm import matplotlib.pyplot as pyplot import pylab def expmodel(p, x): return p[0] + numpy.exp(p[1]*x)*p[2] def experror(p, x, y): return y - expmodel(p, x) def linmodel(p, x): return p[0] + p[1]*x def linerror(p, x, y): return y - linmodel(p, x) if __name__ == '__main__': optparse = argparse.ArgumentParser(description='plot raddark dat files with errorbars and linear or exponential model regression plots', prog=sys.argv[0]) optparse.add_argument('--xlabel', type=str, default='Particle Count') optparse.add_argument('--ylabel', type=str, default='Signal') optparse.add_argument('--title', type=str, default='') optparse.add_argument('--outlier', '-O', action='append', type=str) optfitgrp = optparse.add_mutually_exclusive_group() optfitgrp.add_argument('--exp', '-e', action='store_true') optfitgrp.add_argument('--lin', '-l', action='store_true') optparse.add_argument('--log', action='store_true') optparse.add_argument('files', type=str, nargs='+') options = optparse.parse_args(sys.argv[1:]) data = [ numpy.loadtxt(filename) for filename in options.files ] if options.outlier: outlier = [ numpy.loadtxt(filename) for filename in options.outlier ] ax = pyplot.subplot(1,1,1) if options.log: ax.loglog() ax.set_title(options.title) ax.set_xlabel(options.xlabel) ax.set_ylabel(options.ylabel) ax.grid(True, 'both') for f,d in zip(options.files, data): ax.errorbar(d[..., 0], d[..., 2], d[..., 3], d[..., 1], fmt='o', label=f) if options.outlier: for f,d in zip(options.outlier, outlier): ax.errorbar(d[..., 0], d[..., 2], d[..., 3], d[..., 1], fmt='+', label=f) if options.exp or options.lin: data_xs = numpy.concatenate( [ d[..., 0] for d in data ] ) data_ys = numpy.concatenate( [ d[..., 2] for d in data ] ) if options.outlier: x_max = numpy.nanmax( numpy.concatenate((data_xs, numpy.concatenate([ o[..., 0] for o in outlier ]))) ) x_min = numpy.nanmin( numpy.concatenate((data_xs, numpy.concatenate([ o[..., 0] for o in outlier ]))) ) else: x_max = numpy.nanmax(data_xs) x_min = numpy.nanmin(data_xs) x_ptp = x_max - x_min xs = numpy.arange(x_min - 0.05*x_ptp, x_max + 0.05*x_ptp, x_ptp/1.) if options.exp: p = scipy.optimize.leastsq(experror, [numpy.nanmin(data_ys), 1e-6/x_ptp, 1./numpy.ptp(data_ys)], args=(data_xs, data_ys)) ys = expmodel(p[0], xs) if options.lin: p = scipy.optimize.leastsq(linerror, [numpy.nanmin(data_ys), 1./x_ptp, 1./numpy.ptp(data_ys)], args=(data_xs, data_ys)) ys = linmodel(p[0], xs) ax.plot(xs, ys, label="fit") ax.legend(loc='upper left') pyplot.show() -- Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Errorbars not drawn correctly in logarithmic scales
On Thu, 8 Mar 2012 19:47:05 -0600 Benjamin Root wrote: > Which version of matplotlib are you using? Also, are you setting the > log scale before (preferred) or after (won't work) the call to hist()? Version is matplotlib-1.1.0, installed through standard Gentoo ebuild. And the scale parameters are set before all the drawing calls. Wolfgang -- Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Errorbars not drawn correctly in logarithmic scales
Hi, I've a problem with some errorbars not drawn correctly in (double) logarithmic plots. See this PDF for an example: http://dl.wolfgang-draxinger.net/C6_77MeV_raddamage.pdf The vertical errorbar for the datapoint at x=1e3 are not drawn. Similar also happens for some horizontal errorbars. Using the very same drawing commands, except switching to a logarithmic scaling the errorbars draw just fine. So what's going on there? Wolfgang Draxinger -- Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] imshow of scalar 2D array using a shared color scale
Hi, I've got a datasets of a pixel particle detector for a number of independent events. I'd like to show them in a row but have them all use the same value and thus color range. What's the most straigtforward way to do this? Cheers, Wolfgang Draxinger -- Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users