You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(3) |
Jun
|
Jul
|
Aug
(12) |
Sep
(12) |
Oct
(56) |
Nov
(65) |
Dec
(37) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(59) |
Feb
(78) |
Mar
(153) |
Apr
(205) |
May
(184) |
Jun
(123) |
Jul
(171) |
Aug
(156) |
Sep
(190) |
Oct
(120) |
Nov
(154) |
Dec
(223) |
| 2005 |
Jan
(184) |
Feb
(267) |
Mar
(214) |
Apr
(286) |
May
(320) |
Jun
(299) |
Jul
(348) |
Aug
(283) |
Sep
(355) |
Oct
(293) |
Nov
(232) |
Dec
(203) |
| 2006 |
Jan
(352) |
Feb
(358) |
Mar
(403) |
Apr
(313) |
May
(165) |
Jun
(281) |
Jul
(316) |
Aug
(228) |
Sep
(279) |
Oct
(243) |
Nov
(315) |
Dec
(345) |
| 2007 |
Jan
(260) |
Feb
(323) |
Mar
(340) |
Apr
(319) |
May
(290) |
Jun
(296) |
Jul
(221) |
Aug
(292) |
Sep
(242) |
Oct
(248) |
Nov
(242) |
Dec
(332) |
| 2008 |
Jan
(312) |
Feb
(359) |
Mar
(454) |
Apr
(287) |
May
(340) |
Jun
(450) |
Jul
(403) |
Aug
(324) |
Sep
(349) |
Oct
(385) |
Nov
(363) |
Dec
(437) |
| 2009 |
Jan
(500) |
Feb
(301) |
Mar
(409) |
Apr
(486) |
May
(545) |
Jun
(391) |
Jul
(518) |
Aug
(497) |
Sep
(492) |
Oct
(429) |
Nov
(357) |
Dec
(310) |
| 2010 |
Jan
(371) |
Feb
(657) |
Mar
(519) |
Apr
(432) |
May
(312) |
Jun
(416) |
Jul
(477) |
Aug
(386) |
Sep
(419) |
Oct
(435) |
Nov
(320) |
Dec
(202) |
| 2011 |
Jan
(321) |
Feb
(413) |
Mar
(299) |
Apr
(215) |
May
(284) |
Jun
(203) |
Jul
(207) |
Aug
(314) |
Sep
(321) |
Oct
(259) |
Nov
(347) |
Dec
(209) |
| 2012 |
Jan
(322) |
Feb
(414) |
Mar
(377) |
Apr
(179) |
May
(173) |
Jun
(234) |
Jul
(295) |
Aug
(239) |
Sep
(276) |
Oct
(355) |
Nov
(144) |
Dec
(108) |
| 2013 |
Jan
(170) |
Feb
(89) |
Mar
(204) |
Apr
(133) |
May
(142) |
Jun
(89) |
Jul
(160) |
Aug
(180) |
Sep
(69) |
Oct
(136) |
Nov
(83) |
Dec
(32) |
| 2014 |
Jan
(71) |
Feb
(90) |
Mar
(161) |
Apr
(117) |
May
(78) |
Jun
(94) |
Jul
(60) |
Aug
(83) |
Sep
(102) |
Oct
(132) |
Nov
(154) |
Dec
(96) |
| 2015 |
Jan
(45) |
Feb
(138) |
Mar
(176) |
Apr
(132) |
May
(119) |
Jun
(124) |
Jul
(77) |
Aug
(31) |
Sep
(34) |
Oct
(22) |
Nov
(23) |
Dec
(9) |
| 2016 |
Jan
(26) |
Feb
(17) |
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(8) |
Jul
(6) |
Aug
(5) |
Sep
(9) |
Oct
(4) |
Nov
|
Dec
|
| 2017 |
Jan
(5) |
Feb
(7) |
Mar
(1) |
Apr
(5) |
May
|
Jun
(3) |
Jul
(6) |
Aug
(1) |
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2025 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
|
|
|
|
|
|
1
(7) |
2
(8) |
|
3
(3) |
4
(5) |
5
(2) |
6
(3) |
7
(4) |
8
(11) |
9
(4) |
|
10
|
11
(8) |
12
(10) |
13
(16) |
14
(14) |
15
(13) |
16
(1) |
|
17
|
18
(8) |
19
(6) |
20
(13) |
21
(15) |
22
(5) |
23
(13) |
|
24
(2) |
25
(4) |
26
(1) |
27
(4) |
28
(8) |
29
(11) |
30
(5) |
|
31
(3) |
|
|
|
|
|
|
|
From: zb <za...@ya...> - 2011-07-23 01:15:49
|
Hi
I updated to the latest Qt and PyQt and the memory leak is not there any more. Looks like matplotlib was OK.
Qt 4.7.3
PyQt 4.8.4
Windows OS
Cheers
________________________________
From: zb <za...@ya...>
To: Eric Firing <ef...@ha...>; mat...@li...
Sent: Thursday, June 16, 2011 2:20 PM
Subject: Re: [Matplotlib-users] canvas.draw() + pyqt4 memory leak
Many thanks for the fix. I applied the changes and now I can run the program.
The numbers go up with every canvas draw(). I attached a screenshot with the program you sent (the mpl example) running. The screenshot shows how the memory goes up and up unbounded with every canvas draw(). It would appear then that it leaks memory in some platforms (ie.windows) but others are OK.
I would be OK if I knew how to release the memory back every now and then (maybe every 100 canvas draw()), but I have not been successful to do so.
Cheers
--- On Thu, 6/16/11, Eric Firing <ef...@ha...> wrote:
>From: Eric Firing <ef...@ha...>
>Subject: Re: [Matplotlib-users] canvas.draw() + pyqt4 memory leak
>To:
mat...@li...
>Date: Thursday, June 16, 2011, 1:42 PM
>
>
>On 06/16/2011 04:31 AM, zb wrote:
>> line 1245 of cbook.py is missing the windows platform. So windows cannot
>> be tested.
>>
>
>In the development version of mpl it can (I added it--but too recently
>for it to have gotten into 1.0.1), provided you have the "tasklist"
>executable, which I think is a free download from Microsoft.
>
>If you would like to try it, you could include the new version, below,
>in your test script.
>
>Eric
>
>def report_memory(i=0): # argument may go away
> 'return the memory consumed by process'
> from subprocess import Popen, PIPE
> pid = os.getpid()
> if sys.platform=='sunos5':
> a2 = Popen('ps -p %d -o osz' % pid,
shell=True,
> stdout=PIPE).stdout.readlines()
> mem = int(a2[-1].strip())
> elif sys.platform.startswith('linux'):
> a2 = Popen('ps -p %d -o rss,sz' % pid, shell=True,
> stdout=PIPE).stdout.readlines()
> mem = int(a2[1].split()[1])
> elif sys.platform.startswith('darwin'):
> a2 = Popen('ps -p %d -o rss,vsz' % pid, shell=True,
> stdout=PIPE).stdout.readlines()
> mem = int(a2[1].split()[0])
> elif sys.platform.startswith('win'):
> try:
>
a2 = Popen(["tasklist", "/nh", "/fi", "pid eq %d" % pid],
> stdout=PIPE).stdout.read()
> except OSError:
> raise NotImplementedError(
> "report_memory works on Windows only if "
> "the 'tasklist' program is found")
> mem = int(a2.strip().split()[-2].replace(',',''))
> else:
> raise NotImplementedError(
> "We don't have a memory monitor for %s" % sys.platform)
> return
mem
>
>------------------------------------------------------------------------------
>EditLive Enterprise is the world's most technically advanced content
>authoring tool. Experience the power of Track Changes, Inline Image
>Editing and ensure content is compliant with Accessibility Checking.
>http://p.sf.net/sfu/ephox-dev2dev
>_______________________________________________
>Matplotlib-users mailing list
>Mat...@li...
>https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
Matplotlib-users mailing list
Mat...@li...
https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Jorge G. <jga...@fi...> - 2011-07-22 21:03:41
|
Thank you everyone for your help, In the end, I wasn't able to get Tkinter to register as the backend, so I downloaded and setup PyQt4. Once PyQt4 was setup, I changed the backend to Qt4Agg in the matplotlibrc file and that worked properly. Best Regards, Jorge Garcia On Wed, Jul 13, 2011 at 3:55 PM, Jorge Garcia <jga...@fi...> wrote: > In case it helps, > > I also tried the simple plot test recommended in the matplotlib FAQ: > > Here's the traceback it gave me. > > $HOME=/home/cadsoft > CONFIGDIR=/home/cadsoft/.matplotlib > matplotlib data path > /usr/local/lib/python3.1/dist-packages/matplotlib/mpl-data > loaded rc file > /usr/local/lib/python3.1/dist-packages/matplotlib/mpl-data/matplotlibrc > matplotlib version 1.1.0 > verbose.level helpful > interactive is False > platform is linux2 > Using fontManager instance from > /home/cadsoft/.matplotlib/fontList.py3k.cache > backend agg version v2.2 > > Thanks for all of your help. > > > > On Fri, Jul 8, 2011 at 2:49 PM, Darren Dale <dsd...@gm...> wrote: > >> On Wed, Jun 29, 2011 at 10:46 AM, Jorge Garcia <jga...@fi...> wrote: >> > Hello, >> > >> > I was trying to test out the Python 3 development version with the first >> > plot shown in the pyplot tutorial. Everything seems to work ok until I >> go >> > >> > plt.show() >> > >> > at which point nothing happens, I don't see a plot. Python accepts the >> > command and is waiting for a new command but I have no plot. >> >> Maybe you don't have a python-3 compatible gui library installed, in >> which case your backend is defaulting to AGG, which cannot render a >> window for you. >> >> > I've tried changing the backend in the matplotlibrc file to TkAgg, but I >> > still get nothing, in fact now when I try to import matplotlib I get a >> > traceback error that name -tkagg is not defined, seems like it might be >> > something in the module. >> > >> > Can anyone lend a hand? >> >> Posting the exact traceback would help us help you. I'll hazard a >> guess that you don't have the tk development packages installed, so >> the tkagg backend could not be built when you installed matplotlib for >> py3, and therefore tkagg cannot be selected as your backend. >> >> Darren >> > > |
|
From: SiggiN <sn...@gw...> - 2011-07-22 19:17:13
|
First, thanks to you for your answers!
I tried all the solutions and the one with the AxisGrid Toolkit worked out
best for me.
There are only some small questions left.
How do I change the origin and how do I change fontsize of the ticklabels?
#-----------------------------code------------
import matplotlib
import numpy as np
import matplotlib.cm as cm
import matplotlib.mlab as mlab
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import AxesGrid
import pylab as pyl
matplotlib.rcParams['xtick.direction'] = 'out'
matplotlib.rcParams['ytick.direction'] = 'out'
delta = 0.5
x = np.arange(0, 90.0, delta)
y = np.arange(0, 90.0, delta)
X, Y = np.meshgrid(x, y)
Z1 = mlab.bivariate_normal(X, Y, 16.0, 17.0, 60.0, 60.0)
Z2 = mlab.bivariate_normal(X, Y, 16.5, 23.5, 45, 45)
# difference of Gaussians
Z = 10.0 * (Z2 - Z1)
#plt.figure()
f,(ax,ax2,ax3) = plt.subplots(3,1)
CS = ax.contourf(X, Y, Z)
CS = ax2.contourf(X, Y, Z)
plt.colorbar(CS,cax=ax3,orientation='horizontal')
fig00 = plt.figure(figsize=(10,3.2), dpi=100, facecolor='w', edgecolor='k')
grid = AxesGrid(fig00, 111, # similar to subplot(132)
nrows_ncols = (1, 2),
axes_pad = 0.4,
share_all=True,
label_mode = "L",
cbar_pad = 0.2,
cbar_location = "right",
cbar_mode="single",
)
p0 = grid[0].contourf(X, Y, Z,origin='upper')
p20 = grid[1].contourf(X,Y,Z,origin= 'upper')
#-------------not working---------
ylim = pyl.get(plt.gca(), 'ylim')
plt.setp(plt.gca(), ylim=ylim[::-1])#
#---------------------------------------
plt.colorbar(p0, cax = grid.cbar_axes[0])
for cax in grid.cbar_axes:
cax.toggle_label(True)
grid[0].set_xticks([0,90,45])
grid[0].set_yticks(pyl.arange(0,100,10))
grid[1].set_xticks([0,90,45])
grid[1].set_yticks(pyl.arange(0,100,10))
grid[0].set_xlabel('phi 1', fontsize=8)
grid[1].set_xlabel('phi 1', fontsize=8)
grid[0].set_ylabel('$\Phi$', fontsize=12)
grid[1].set_ylabel('$\Phi$', fontsize=12)
plt.show()
Siggi
--
View this message in context: http://old.nabble.com/Decouple-the-colorbar-form-subplot-tp32037832p32117770.html
Sent from the matplotlib - users mailing list archive at Nabble.com.
|
|
From: Yoshi R. <yo...@ro...> - 2011-07-22 11:39:57
|
+----------------------------------------- Jeff Whitaker -----------+ > > > > Jeff, I just had a thought.... > > > > Isn't the country borders drawn as Path or Polygon objects? I believe > > there are some matplotlib internal functions that can be given a list > > of points (such as those for a grid) and a path and it will return > > which points are within the path and which are outside. One could use > > that to make the mask. > > > > Might make for a nice feature for basemap in the upcoming v1.1.0 release. > > > > Ben Root > > > Ben/Yoshi: The countries are not polygons, they are line segments. > Worse yet, they are all just lumped together with no metadata (no way to > know which lines define the country you want). If you had a shapefile > with just the country of interest in it, defined as a polygon, then it's > doable You could take a look at the source code for the is_land method, > which tests to see if a given x,y point is inside any of the continent > polygons. > > Let us know if you have you have the country polygon, and then I can > help you with the details. > > -Jeff > Sorry for being late, i was really busy. Thank you for your offer, I have the polygon now (attached), could you help me with this? Best regards, Yoshi |
|
From: Morgan B. <mor...@ya...> - 2011-07-22 08:59:56
|
Hello, I am trying to plot a line from 2 arrays of data (dates on the x axis) in a qt widget, so that I can update the line quickly when the user changes the data selection through a qcombobox and so that the widget containing the plot can be resized (matplotlib and qt-pyside). I managed to obtain a line that I can update using plot_date and clearing the axis before issuing an ax.draw, but then the figure only updates after is has been resized, not on the draw() call (I think it may have to do with qt not redrawing the frame rather than matplotlib not updating the plot). I then tried the animation examples from the website but the plot I obtained misbehaves when resized (looks like I get two plots: the presiously sized plot and the newly sized plot on top of each other). I have been looking at the examples on the website but haven't found an example of an animated plot that can be resized by the user in a gui environment. Would you have such an example or maybe you can point me to an example that I missed on the website? Thanks Morgan |
|
From: gary r. <gr...@bi...> - 2011-07-22 00:46:47
|
Hi Ben, Comments inline... On Fri, Jul 22, 2011 at 1:31 AM, Benjamin Root <ben...@ou...> wrote: > > > On Thu, Jul 21, 2011 at 1:10 AM, gary ruben <gar...@gm...> wrote: >> >> I'm trying to make a surface plot using the latest version of mplot3d >> from the git trunk and I have a couple of questions. The attached >> image is close to what I would like. The associated plot command I am >> using is >> >> ax.plot_surface(X, Y, Z, rstride=1, cstride=1, alpha=0.8, shade=True, >> cmap=plt.cm.summer, >> color='k', >> facecolors='k', >> lightsource = LightSource(azdeg=0, altdeg=0), >> ) >> >> 1. Is there support now to automatically annotate the axis so that a >> multiplier is added, as occurs in 2D plots, or should I do this >> manually by rescaling the data for the moment? > > Yes, offset text is now automatic and should activate in similar manner as > it does for regular 2D axis formatters. You were one order of magnitude off > from automatically triggering it. Also, I should note that it might be > better to use "ax = fig.gca(projection='3d')" instead of "ax = Axes3D(fig)" > because the former will leave more of a margin, which would allow the offset > text to be fully visible. Thanks. That's actually what I am doing but I cropped the output image before attaching it. > If you want the full figure area, then you may > need to fiddle with the ax.zaxis._axinfo['label']['space_factor'] to bring > it and the axis label closer to the axis. Thanks. That's useful to know. > The odd thing that I am encountering right now while investigating your > problem is that I can't seem to force the use of the offset. It could just > be that I am doing it wrong, but I will look closer. Yes, I had set 'axes.formatter.limits' : (-2, 2) hoping to trigger it - I guess that's what you tried. >> 2. Currently, it doesn't appear possible to shade the surface patches >> according to just a base facecolor and their orientation to a light >> source. Do I have to define a new colormap with a constant/single >> colour to achieve this? > > Looking over the plot_surface code, this appears to be the case, however, > looking back over the LightSource code, I believe it might be possible to > update plot_surface to operate on situations where no cmap is specified. I > will take a look today at that possibility and see if I can get it out for > the v1.1.0 release. That would be great - it is a very good way to visualize a surface so it should be made as simple as possible. >> 3. I have set alpha=0.8 to allow the wireframe lines to show through a >> little. When shade=False, the wireframe is visible but I lose >> orientation-based shading. Is there a way to overlay the wireframe >> properly when shade=True? >> > > In plot_surface, when shade=True, it appears that both the facecolors and > the edgecolors are set to the same colors. The only reason why the lines > show up when you set transparency is that that alpha value is applied only > to the faces and not the edges. Specifically, the logic is as follows: > > if fcolors is specified, then set that color for both facecolor and > edgecolor. > Else, if a cmap is specified, then give the polygon collection the data, > limits and norm it needs to determine color itself. > Else, then use the value of "color" to specify only the facecolors. > > I think the first branch of this logic is a bit wonky. I agree, since fcolors must be specified in order to trigger the lightsource-based shading. > I am inclined to > make a small change that would only set the edgecolors if 'edgecolors' was > not provided as a kwarg. This would enable users to specify the edgecolor > they want without worrying about something else over-riding it. The only > problem seems to be that there would be no shading of these grid lines. > Would that still be acceptable to you? Absolutely acceptable. In fact I think it is preferable not to shade them. > Thanks for your valuable feedback! > Ben Root Thanks for being responsive to it :) regards, Gary |
|
From: Fernando M. <fer...@gm...> - 2011-07-21 21:02:12
|
I am facing problems for plotting figures using polycollection. The code below should do: 1- set two triangles: one with vertices at [0,0 0,1 1,0] and the other at [1,0 0,1 1,1] 2- give two random values to them 3- add these polygons to polycollection and set their values 4- plot the triangles edges only with triplot and save the eps 4.5- plot again with triplot and save the eps (I will explain why I am doing this) 5- plot the image with the values (using add_collection) and save as eps 6- set two new random values to these triangles (this step is not needed to reproduce the error) 7- plot again the image (using add_collection) and save as eps Steps 1 to 6 seem to be ok. The problem is that on step 7, the triangles are displaced in x and y directions. The graph is shown correctly on screen, however this displacement appears on the output file. This displacement does not appears when I plot twice the mesh with triplot. Only when I plot using add_collection. Thanks. Fernando. my settings are: matplotlib version: 1.0.1 matplotlib obtained from: deb http://ppa.launchpad.net/valavanisalex/matplotlib/ubuntu natty main system: Linux kalman 2.6.38-10-generic #46-Ubuntu SMP Tue Jun 28 15:07:17 UTC 2011 x86_64 x86_64 x86_64 GNU/Linux no customizations on matplotlibrc running python with --verbose-helpful option returns $HOME=/home/fernando CONFIGDIR=/home/fernando/.matplotlib matplotlib data path /usr/share/matplotlib/mpl-data loaded rc file /etc/matplotlibrc matplotlib version 1.0.1 verbose.level helpful interactive is False units is False platform is linux2 Using fontManager instance from /home/fernando/.matplotlib/fontList.cache backend TkAgg version 8.5 findfont: Matching :family=sans-serif:style=normal:variant=normal:weight=normal:stretch=normal:size=medium to DejaVu Sans (/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf) with score of 0.100000 #------------------------------- # CODE - CODE - CODE #------------------------------- # -*- coding: utf-8 -*- import os import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib.tri as tri from matplotlib.collections import PolyCollection import numpy as np class triangles_mesh(): def __init__(self,coords,topology,colormap=cm.gray): values=np.random.rand(topology.shape[0]) self.triangles=self.build_triangles(coords,topology,values,colormap) def build_triangles(self,coords,topology,image_rho,map_colors=cm.jet): (n_elem,n_nodes_local)=topology.shape lista_tri=[] colors=[] values_rho=[] for j in range(0,n_elem): verts = [(coords[i,0], coords[i,1]) for i in topology[j,:]] lista_tri.append(verts) values_rho.append(image_rho[j]) norma = cm.colors.Normalize(vmin=0, vmax=3) poligonos = PolyCollection(lista_tri,lw=0.4,cmap=map_colors,norm=norma) poligonos.set_array(np.array(values_rho)) return poligonos class mesh_2D(): def __init__(self): self.topology=np.array([[0,1,2],[1,3,2]]) self.coords=np.array([[0,0],[1,0],[0,1],[1,1]]) self.roi=np.array([1,2]) self.elem=triangles_mesh(self.coords,self.topology) def plot_mesh(self,file_name=None,flag_show_image=1): fig=plt.figure() my_axis=fig.add_subplot(111,aspect='equal') my_axis.triplot(self.coords[:,0],self.coords[:,1], self.topology,color=[0, 0,0 ],lw=0.4) plt.yticks([]) plt.xticks([]) my_axis.axis('off') x_max,y_max=self.coords.max(0) x_min,y_min=self.coords.min(0) my_axis.axis([x_min, x_max, y_min, y_max]) plt.draw() if file_name!=None: plt.savefig(file_name,transparent=True,format="eps",bbox_inches="tight") if flag_show_image==1: plt.show() plt.close() def plot_values(self,file_name=None,flag_show_image=1): fig=plt.figure() my_axis=fig.add_subplot(111,aspect='equal') my_axis.add_collection(self.elem.triangles) #plt.yticks([]) #plt.xticks([]) #my_axis.axis('off') x_max,y_max=self.coords.max(0) x_min,y_min=self.coords.min(0) my_axis.axis([x_min, x_max, y_min, y_max]) fig.canvas.draw() if file_name!=None: plt.savefig(file_name,transparent=True,format="eps",bbox_inches="tight") if flag_show_image==1: plt.show() plt.close() malha_pd=mesh_2D() malha_pd.plot_mesh("mesh.eps",flag_show_image=0) malha_pd.plot_mesh("mesh1.eps",flag_show_image=0) malha_pd.plot_values("values.eps",flag_show_image=1) # set new values () new_values=np.random.rand(malha_pd.topology.shape[0]) malha_pd.elem.triangles.set_array(np.array(new_values)) #plot again: here the problem appears malha_pd.plot_values("values1.eps",flag_show_image=1) #-------------------------- # END CODE - END CODE #-------------------------- |
|
From: Paul I. <piv...@gm...> - 2011-07-21 19:53:40
|
Hi Robert, robert rottermann, on 2011-07-21 11:25, wrote: > who ever migth be interested: > I achieved my goal in drawing lines trough a set of points using the path modul. > > http://matplotlib.sourceforge.net/users/path_tutorial.html Unless there were other considerations for getting this plot, it really didn't have to be this complicated, read on. > On 20.07.2011 20:49, robert rottermann wrote: > > frame1 = plt.gca() > > lx = [] > > ly = [] > > for pt in ((267, 140), (380, 773), (267, 958)): > > lx.append(pt[0]) > > ly.append(pt[1]) > > x,y = np.array([lx, ly]) > > line = mlines.Line2D(x, y, lw=5., alpha=0.4) > > frame1.add_line(line) The above can be done with just two lines: x,y = zip(*((267, 140), (380, 773), (267, 958))) 1.plot(x,y) best, -- Paul Ivanov 314 address only used for lists, off-list direct email at: http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 |
|
From: Benjamin R. <ben...@ou...> - 2011-07-21 15:32:17
|
On Thu, Jul 21, 2011 at 1:10 AM, gary ruben <gar...@gm...> wrote: > I'm trying to make a surface plot using the latest version of mplot3d > from the git trunk and I have a couple of questions. The attached > image is close to what I would like. The associated plot command I am > using is > > ax.plot_surface(X, Y, Z, rstride=1, cstride=1, alpha=0.8, shade=True, > cmap=plt.cm.summer, > color='k', > facecolors='k', > lightsource = LightSource(azdeg=0, altdeg=0), > ) > > 1. Is there support now to automatically annotate the axis so that a > multiplier is added, as occurs in 2D plots, or should I do this > manually by rescaling the data for the moment? > Yes, offset text is now automatic and should activate in similar manner as it does for regular 2D axis formatters. You were one order of magnitude off from automatically triggering it. Also, I should note that it might be better to use "ax = fig.gca(projection='3d')" instead of "ax = Axes3D(fig)" because the former will leave more of a margin, which would allow the offset text to be fully visible. If you want the full figure area, then you may need to fiddle with the ax.zaxis._axinfo['label']['space_factor'] to bring it and the axis label closer to the axis. The odd thing that I am encountering right now while investigating your problem is that I can't seem to force the use of the offset. It could just be that I am doing it wrong, but I will look closer. > 2. Currently, it doesn't appear possible to shade the surface patches > according to just a base facecolor and their orientation to a light > source. Do I have to define a new colormap with a constant/single > colour to achieve this? Looking over the plot_surface code, this appears to be the case, however, looking back over the LightSource code, I believe it might be possible to update plot_surface to operate on situations where no cmap is specified. I will take a look today at that possibility and see if I can get it out for the v1.1.0 release. > 3. I have set alpha=0.8 to allow the wireframe lines to show through a > little. When shade=False, the wireframe is visible but I lose > orientation-based shading. Is there a way to overlay the wireframe > properly when shade=True? > > In plot_surface, when shade=True, it appears that both the facecolors and the edgecolors are set to the same colors. The only reason why the lines show up when you set transparency is that that alpha value is applied only to the faces and not the edges. Specifically, the logic is as follows: if fcolors is specified, then set that color for both facecolor and edgecolor. Else, if a cmap is specified, then give the polygon collection the data, limits and norm it needs to determine color itself. Else, then use the value of "color" to specify only the facecolors. I think the first branch of this logic is a bit wonky. I am inclined to make a small change that would only set the edgecolors if 'edgecolors' was not provided as a kwarg. This would enable users to specify the edgecolor they want without worrying about something else over-riding it. The only problem seems to be that there would be no shading of these grid lines. Would that still be acceptable to you? Thanks for your valuable feedback! Ben Root |
|
From: Yoshi R. <yo...@ro...> - 2011-07-21 09:26:17
|
what are you using right now, something like that? >>> a = np.random.random(70) >>> x = np.empty([10,a.shape[0]]) >>> x[:,:] = a >>> pl.contourf(x) you might want to suppress ticks on the y-axis. best regards, yoshi |
|
From: robert r. <ro...@re...> - 2011-07-21 09:26:07
|
who ever migth be interested: I achieved my goal in drawing lines trough a set of points using the path modul. http://matplotlib.sourceforge.net/users/path_tutorial.html robert On 20.07.2011 20:49, robert rottermann wrote: > hi there, > > I would like to draw a a set of lines on top of an image. > Somehow I do not get the result I want > > these are the points ((267, 140), (380, 773), (267, 958)) > > one of my divers atempts is: > > pic = plt.imread('../hlwd/effizienz_balken_01.jpg') > pic = np.fliplr(np.rot90(pic, k=2)) > plt.imshow(pic) > > frame1 = plt.gca() > > lx = [] > ly = [] > for pt in ((267, 140), (380, 773), (267, 958)): > lx.append(pt[0]) > ly.append(pt[1]) > x,y = np.array([lx, ly]) > line = mlines.Line2D(x, y, lw=5., alpha=0.4) > > frame1.add_line(line) > > plt.show() > > which produces on line instad of two. > > thanks for any pointers > robert > > > ------------------------------------------------------------------------------ > 10 Tips for Better Web Security > Learn 10 ways to better secure your business today. Topics covered include: > Web security, SSL, hacker attacks& Denial of Service (DoS), private keys, > security Microsoft Exchange, secure Instant Messaging, and much more. > http://www.accelacomm.com/jaw/sfnl/114/51426210/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: gary r. <gr...@bi...> - 2011-07-21 06:12:44
|
I'm trying to make a surface plot using the latest version of mplot3d from the git trunk and I have a couple of questions. The attached image is close to what I would like. The associated plot command I am using is ax.plot_surface(X, Y, Z, rstride=1, cstride=1, alpha=0.8, shade=True, cmap=plt.cm.summer, color='k', facecolors='k', lightsource = LightSource(azdeg=0, altdeg=0), ) 1. Is there support now to automatically annotate the axis so that a multiplier is added, as occurs in 2D plots, or should I do this manually by rescaling the data for the moment? 2. Currently, it doesn't appear possible to shade the surface patches according to just a base facecolor and their orientation to a light source. Do I have to define a new colormap with a constant/single colour to achieve this? Currently, it seems necessary to specify a colormap and that this is used instead of the patch facecolors option, but facecolors must still be specified to trigger the orientation-based shading. It seems a bit bizarre to have to define a cmap and facecolors when facecolors is actually ignored by the rendering. 3. I have set alpha=0.8 to allow the wireframe lines to show through a little. When shade=False, the wireframe is visible but I lose orientation-based shading. Is there a way to overlay the wireframe properly when shade=True? thanks, Gary |
|
From: gary r. <gar...@gm...> - 2011-07-21 06:11:20
|
I'm trying to make a surface plot using the latest version of mplot3d
from the git trunk and I have a couple of questions. The attached
image is close to what I would like. The associated plot command I am
using is
ax.plot_surface(X, Y, Z, rstride=1, cstride=1, alpha=0.8, shade=True,
cmap=plt.cm.summer,
color='k',
facecolors='k',
lightsource = LightSource(azdeg=0, altdeg=0),
)
1. Is there support now to automatically annotate the axis so that a
multiplier is added, as occurs in 2D plots, or should I do this
manually by rescaling the data for the moment?
2. Currently, it doesn't appear possible to shade the surface patches
according to just a base facecolor and their orientation to a light
source. Do I have to define a new colormap with a constant/single
colour to achieve this? Currently, it seems necessary to specify a
colormap and that this is used instead of the patch facecolors option,
but facecolors must still be specified to trigger the
orientation-based shading. It seems a bit bizarre to have to define a
cmap and facecolors when facecolors is actually ignored by the
rendering.
3. I have set alpha=0.8 to allow the wireframe lines to show through a
little. When shade=False, the wireframe is visible but I lose
orientation-based shading. Is there a way to overlay the wireframe
properly when shade=True?
thanks,
Gary
|
|
From: C M <cmp...@gm...> - 2011-07-21 03:34:04
|
> Try MultipleLocator: > > from matplotlib.ticker import MultipleLocator > halflocator = MultipleLocator(base=0.5) > ax.xaxis.set_major_locator(halflocator) > > etc. Thanks, that works for me. I didn't think I could use non-integers (0.5) because the docs said, "Set a tick on every integer that is multiple of base in the view interval". Earlier in that page, though, it does say base can be an integer or float. Che |
|
From: Charles R H. <cha...@gm...> - 2011-07-21 03:15:32
|
Hi Robert,
On Fri, Jul 15, 2011 at 9:49 AM, robert <ro...@re...> wrote:
> Hi there,
> I am all new to mathlib world..
>
> What I try to do is plotting some charts over an image.
> I would be very grateful, if somebody could provide me with an example.
> thanks
> robert
>
>
I just did this myself with this code:
def make_cutouts(h5file, band=1, vmin=None, vmax=None, dir='.'):
"""Browse pixel data by pixel selection
A shift-left-click on a pixel in ``image`` creates a plot of
the response data for that pixel. A shift--click on the
resulting plot will save it to two files in ``dir`` whose names
are of the form cutout-xcen-ycen.{dat,png}, where xcen and ycen
are replaced with the location of image center. The png file is
an rgb img, the dat file is raw uint16 data.
Parameters
----------
h5file : string
Path to h5 file containing image data.
band : int
Band to use. Must be 0 or 1.
vmax, vmin : float, optional
Maximum and minimum values to which the image will be scaled.
dir : string, optional
Path to directory in which plots will be saved.
"""
import matplotlib.pyplot as plt
import h5py
from widgets import Button
# get image data here so that it gets compiled into onclick
fin = h5py.File(h5file, 'r')
img = fin['band%d' % band][...]
src = fin['/'].attrs['input_filename']
fin.close()
m, n = img.shape
# make points for drawing square cutout
xcor = np.array([-128, 128, 128, -128, -128], dtype=float)/10
ycor = np.array([-128, -128, 128, 128, -128], dtype=float)/10
def save(fig, mouse, data):
def onclick(event):
if event.button == 1:
xcen = mouse.xdata
ycen = mouse.ydata
i = int(xcen + .5)*10
j = int(ycen + .5)*10
# write data to file
path = os.path.join(dir, 'cutout-%05d-%05d' % (i,j))
fout = h5py.File(path + '.h5', 'w')
fout.create_dataset('image', data.shape, data.dtype)
fout['/'].attrs['input_filename'] = src
fout['/'].attrs['x_center_pixel'] = i
fout['/'].attrs['y_center_pixel'] = j
fout['image'][...] = data
fout.close()
fig.savefig(path + ".png")
# draw square around cutout
mouse.inaxes.plot(xcen + xcor, ycen + ycor, 'r', lw=2)
mouse.canvas.draw()
return onclick
def onclick(event):
mouse = event.mouseevent
if mouse.button == 1 and mouse.key == "shift":
i = int(mouse.xdata + .5)*10
j = int(mouse.ydata + .5)*10
src_axs = mouse.inaxes
ul_x = max(0, i - 128)
ul_y = max(0, j - 128)
lr_x = min(n, i + 128)
lr_y = min(m, j + 128)
data = img[ul_y:lr_y, ul_x:lr_x]
#
newfig = plt.figure()
newfig.subplots_adjust(top=.90)
# add save button
butax = newfig.add_axes([0.45, .92, .1, 0.04])
button = Button(butax, 'Save', color='red', hovercolor='gold')
button.on_clicked(save(fig, mouse, data))
# display image of cutout
axs = newfig.add_subplot(111)
tmp = axs.imshow(data)
newfig.colorbar(tmp)
newfig.show()
fig = plt.figure()
axs = fig.add_subplot(111)
tmp = axs.imshow(img[::10, ::10], vmin=vmin, vmax=vmax, origin='lower',
picker=True)
xmin, xmax, ymin, ymax = np.array(tmp.get_extent()) + .5
axs.set_xticks([t for t in axs.get_xticks() if t >= 0 and t <= xmax])
axs.set_yticks([t for t in axs.get_yticks() if t >= 0 and t <= ymax])
fig.canvas.mpl_connect("pick_event", onclick)
fig.show()
Which is probably more complex than what you need. What it does is display a
thumbnail of a very large image on which you can shift-click to blowup a
256x256 portion in a separate figure. If you then click the (custom) save
button on the blowup it saves the data together with a thumbnail and plots a
square around the cutout pixels in the original image. The tricky part is
that the image axis generally starts at -.5 and this will cause problems as
the plot will want to put up it's own ticks that excede the image bounds and
you will get big white borders where you don't want them. Hence I call
axs.set_xticks etc. to remove the offending ticks. To bad the image itself
doesn't make its own ticks available.
I had to rewrite the button code to make this work as the first click
handler takes the button with it when it exits as the figure doesn't keep a
reference to it, but that is another problem ;)
Chuck
|
|
From: C M <cmp...@gm...> - 2011-07-21 03:12:28
|
A runnable code sample is attached. I'm trying to plot durations in time (sec to hours) on the y axis such that if you zoom, it changes the units and axis label appropriately. When run, it looks right. But, when I zoom on the first point, it is shown on the y axis at '0.20' minutes. I would like it to say '12 seconds'. I would think the FuncFormatter I am trying to use should be able to do that, but I cannot figure it out. For now, those attempts are commented out in the code. How can I create a formatter such that zooming changes the tick and axis labels in this way? Any help is appreciated. Thanks, Che |
|
From: Gerald S. <gd...@mr...> - 2011-07-21 02:21:05
|
The version of PySide doesn't really matter so long as it is reasonably new. You need a newer version of Matplotlib and yes, the Github master is newer than the current release. Gerald. On 20/07/2011 8:29 PM, lionel chiron wrote: > Hi Gerald again, > > I recuperated the Pyside last version the 1.0.4 from Pyside's site but > I obtained the same error message trying to use my former code (same > used with PyQt with Figure Canvas) > raise ImportError, "Warning: formlayout requires PyQt4>v4.3" > Is the github version even more recent than this one?? > Thanks > > Regards > Lionel > > > 2011/7/20 Gerald Storer <gd...@mr... <mailto:gd...@mr...>> > > Have a closer look at the example I gave. > > The currently released version of matplotlib doesn't support > PySide at all. So I cheated and simply drew to the generic Agg > backend and then copied the whole figure (gcf = get current > figure) into a PySide QImage object at the end. The QImage can > then be displayed however you want inside your Qt application. I > used a QGraphicsScene but there are other options. > > If you really wanted to I guess you could use FigureCanvasAgg as > an intermediary - but the process is fundamentally different. You > can't just drop that it into your PySide app as a widget like you > can with FigureCanvasQTAgg. > > As mentioned earlier, if you'd like to use the same code simply > wait for the next release of matplotlib which will support PySide > or you can get a copy of the source from github master today that > also support PySide. > > Gerald. > > > On 20/07/2011 3:59 PM, lionel chiron wrote: >> Hi Gerald, >> >> I found yesterday interesting informations on a forum where you >> answered about Matplotlib and pyside .. but some details are >> missing to make what I want. >> Few days ago I developped stuff in PyQt I 'd like to recuperate >> in Pyside.. the central difficulty is to import Matplotlib in >> Pyside. >> In PyQt I was using FigureCanvasQTAgg but in Pyside I couldn't >> find something equivalent allowing to link Mpl and pyside.. >> It seems you're able to make drawings (with add.patch) but how to >> do for inserting a figure? >> >> Thanks >> >> Best >> >> Lionel > > > |
|
From: Eric F. <ef...@ha...> - 2011-07-21 01:37:21
|
On 07/20/2011 03:17 PM, C M wrote: > On Wed, Jul 20, 2011 at 7:56 PM, Gökhan Sever<gok...@gm...> wrote: >> >> >> On Wed, Jul 20, 2011 at 5:41 PM, C M<cmp...@gm...> wrote: >>> >>> On Wed, Jul 20, 2011 at 7:24 PM, Buchholz, Greg >>> <gbu...@in...> wrote: >>>>> -----Original Message----- >>>>> From: C M [mailto:cmp...@gm...] >>>>> >>>>> Sorry, this is super-simple, but I'm lost in the whole >>>>> locator/formatter part of the docs. >>>>> >>>>> How can I make a locator that just places a tick at every multiple of >>>>> 0.5 around the data? So the y axis would look like: >>>>> >>>>> 3.5 -- >>>>> 3.0 -- >>>>> 2.5 -- >>>>> 2.0 -- >>>>> 1.5 -- >>>>> 1.0 -- >>>> >>>> Do you want something like: >>>> >>>> ylim(1.0,3.5) >>>> yticks(arrange(1.0,4.0,0.5)) >>> >>> I'm not sure, because I can't try it out--I'm using the OO matplotlib, >>> not Pyplot. What's the equivalent of this in the OO API? >> >> >> ax.axis((xmin, xmax, ymin, ymax)) >> ax.yaxis.set_ticks(np.arange(1.0, 4.0, 0.5)) > > Thanks. > > But in order to use this, I have to know ymin and ymax, based on the > data. But I thought this was the point of the locators--that they > could assign the ticks based on the range of the data and then some > rule about placement of ticks in that range. But when I look at the > various kinds of locators in the docs, none have a parameter that is > equivalent to the 0.5 above in set_ticks. > > Or do they and I just missed it? Try MultipleLocator: from matplotlib.ticker import MultipleLocator halflocator = MultipleLocator(base=0.5) ax.xaxis.set_major_locator(halflocator) etc. > > ------------------------------------------------------------------------------ > 5 Ways to Improve& Secure Unified Communications > Unified Communications promises greater efficiencies for business. UC can > improve internal communications as well as offer faster, more efficient ways > to interact with customers and streamline customer service. Learn more! > http://www.accelacomm.com/jaw/sfnl/114/51426253/ > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
|
From: Gökhan S. <gok...@gm...> - 2011-07-21 01:20:05
|
On Wed, Jul 20, 2011 at 7:17 PM, C M <cmp...@gm...> wrote: > On Wed, Jul 20, 2011 at 7:56 PM, Gökhan Sever <gok...@gm...> > wrote: > > > > > > On Wed, Jul 20, 2011 at 5:41 PM, C M <cmp...@gm...> wrote: > >> > >> On Wed, Jul 20, 2011 at 7:24 PM, Buchholz, Greg > >> <gbu...@in...> wrote: > >> >>-----Original Message----- > >> >>From: C M [mailto:cmp...@gm...] > >> >> > >> >>Sorry, this is super-simple, but I'm lost in the whole > >> >>locator/formatter part of the docs. > >> >> > >> >>How can I make a locator that just places a tick at every multiple of > >> >>0.5 around the data? So the y axis would look like: > >> >> > >> >>3.5 -- > >> >>3.0 -- > >> >>2.5 -- > >> >>2.0 -- > >> >>1.5 -- > >> >>1.0 -- > >> > > >> > Do you want something like: > >> > > >> > ylim(1.0,3.5) > >> > yticks(arrange(1.0,4.0,0.5)) > >> > >> I'm not sure, because I can't try it out--I'm using the OO matplotlib, > >> not Pyplot. What's the equivalent of this in the OO API? > > > > > > ax.axis((xmin, xmax, ymin, ymax)) > > ax.yaxis.set_ticks(np.arange(1.0, 4.0, 0.5)) > > Thanks. > > But in order to use this, I have to know ymin and ymax, based on the > data. But I thought this was the point of the locators--that they > could assign the ticks based on the range of the data and then some > rule about placement of ticks in that range. But when I look at the > various kinds of locators in the docs, none have a parameter that is > equivalent to the 0.5 above in set_ticks. > > Or do they and I just missed it? > You can call min and max functions on your data arrays and make adjustments in your tick placement accordingly. -- Gökhan |
|
From: C M <cmp...@gm...> - 2011-07-21 01:17:29
|
On Wed, Jul 20, 2011 at 7:56 PM, Gökhan Sever <gok...@gm...> wrote: > > > On Wed, Jul 20, 2011 at 5:41 PM, C M <cmp...@gm...> wrote: >> >> On Wed, Jul 20, 2011 at 7:24 PM, Buchholz, Greg >> <gbu...@in...> wrote: >> >>-----Original Message----- >> >>From: C M [mailto:cmp...@gm...] >> >> >> >>Sorry, this is super-simple, but I'm lost in the whole >> >>locator/formatter part of the docs. >> >> >> >>How can I make a locator that just places a tick at every multiple of >> >>0.5 around the data? So the y axis would look like: >> >> >> >>3.5 -- >> >>3.0 -- >> >>2.5 -- >> >>2.0 -- >> >>1.5 -- >> >>1.0 -- >> > >> > Do you want something like: >> > >> > ylim(1.0,3.5) >> > yticks(arrange(1.0,4.0,0.5)) >> >> I'm not sure, because I can't try it out--I'm using the OO matplotlib, >> not Pyplot. What's the equivalent of this in the OO API? > > > ax.axis((xmin, xmax, ymin, ymax)) > ax.yaxis.set_ticks(np.arange(1.0, 4.0, 0.5)) Thanks. But in order to use this, I have to know ymin and ymax, based on the data. But I thought this was the point of the locators--that they could assign the ticks based on the range of the data and then some rule about placement of ticks in that range. But when I look at the various kinds of locators in the docs, none have a parameter that is equivalent to the 0.5 above in set_ticks. Or do they and I just missed it? |
|
From: Gökhan S. <gok...@gm...> - 2011-07-20 23:56:37
|
On Wed, Jul 20, 2011 at 5:41 PM, C M <cmp...@gm...> wrote:
> On Wed, Jul 20, 2011 at 7:24 PM, Buchholz, Greg
> <gbu...@in...> wrote:
> >>-----Original Message-----
> >>From: C M [mailto:cmp...@gm...]
> >>
> >>Sorry, this is super-simple, but I'm lost in the whole
> >>locator/formatter part of the docs.
> >>
> >>How can I make a locator that just places a tick at every multiple of
> >>0.5 around the data? So the y axis would look like:
> >>
> >>3.5 --
> >>3.0 --
> >>2.5 --
> >>2.0 --
> >>1.5 --
> >>1.0 --
> >
> > Do you want something like:
> >
> > ylim(1.0,3.5)
> > yticks(arrange(1.0,4.0,0.5))
>
> I'm not sure, because I can't try it out--I'm using the OO matplotlib,
> not Pyplot. What's the equivalent of this in the OO API?
>
ax.axis((xmin, xmax, ymin, ymax))
ax.yaxis.set_ticks(np.arange(1.0, 4.0, 0.5))
>
> Thanks,
> Che
>
>
> ------------------------------------------------------------------------------
> 10 Tips for Better Web Security
> Learn 10 ways to better secure your business today. Topics covered include:
> Web security, SSL, hacker attacks & Denial of Service (DoS), private keys,
> security Microsoft Exchange, secure Instant Messaging, and much more.
> http://www.accelacomm.com/jaw/sfnl/114/51426210/
> _______________________________________________
> Matplotlib-users mailing list
> Mat...@li...
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>
--
Gökhan
|
|
From: C M <cmp...@gm...> - 2011-07-20 23:41:39
|
On Wed, Jul 20, 2011 at 7:24 PM, Buchholz, Greg <gbu...@in...> wrote: >>-----Original Message----- >>From: C M [mailto:cmp...@gm...] >> >>Sorry, this is super-simple, but I'm lost in the whole >>locator/formatter part of the docs. >> >>How can I make a locator that just places a tick at every multiple of >>0.5 around the data? So the y axis would look like: >> >>3.5 -- >>3.0 -- >>2.5 -- >>2.0 -- >>1.5 -- >>1.0 -- > > Do you want something like: > > ylim(1.0,3.5) > yticks(arrange(1.0,4.0,0.5)) I'm not sure, because I can't try it out--I'm using the OO matplotlib, not Pyplot. What's the equivalent of this in the OO API? Thanks, Che |
|
From: Buchholz, G. <gbu...@In...> - 2011-07-20 23:39:46
|
>-----Original Message-----
>From: C M [mailto:cmp...@gm...]
>
>Sorry, this is super-simple, but I'm lost in the whole
>locator/formatter part of the docs.
>
>How can I make a locator that just places a tick at every multiple of
>0.5 around the data? So the y axis would look like:
>
>3.5 --
>3.0 --
>2.5 --
>2.0 --
>1.5 --
>1.0 --
Do you want something like:
ylim(1.0,3.5)
yticks(arrange(1.0,4.0,0.5))
|
|
From: C M <cmp...@gm...> - 2011-07-20 20:23:23
|
Sorry, this is super-simple, but I'm lost in the whole locator/formatter part of the docs. How can I make a locator that just places a tick at every multiple of 0.5 around the data? So the y axis would look like: 3.5 -- 3.0 -- 2.5 -- 2.0 -- 1.5 -- 1.0 -- etc. Thanks, Che |
|
From: robert r. <ro...@re...> - 2011-07-20 18:49:19
|
hi there,
I would like to draw a a set of lines on top of an image.
Somehow I do not get the result I want
these are the points ((267, 140), (380, 773), (267, 958))
one of my divers atempts is:
pic = plt.imread('../hlwd/effizienz_balken_01.jpg')
pic = np.fliplr(np.rot90(pic, k=2))
plt.imshow(pic)
frame1 = plt.gca()
lx = []
ly = []
for pt in ((267, 140), (380, 773), (267, 958)):
lx.append(pt[0])
ly.append(pt[1])
x,y = np.array([lx, ly])
line = mlines.Line2D(x, y, lw=5., alpha=0.4)
frame1.add_line(line)
plt.show()
which produces on line instad of two.
thanks for any pointers
robert
|