[Matplotlib-users] Difference in show and output file

2012-05-23 Thread rajtendulkar

Dear All,

I am trying to write a program in matplotlib to generate stacked bar graphs.
My problem is that the commands -  plt.show() and self.fig.savefig(fileName)
generate different outputs.
I tried different output formats like PDF, PNG, EPS. But the problem remains
the same.
This happens for the lines that I am trying to draw outside the plot.
I am trying to draw vertical lines between xticklabels.
I have uploaded the data file and the code file.
http://old.nabble.com/file/p33893817/data.dat data.dat 
http://old.nabble.com/file/p33893817/matplot1.py matplot1.py 
Could anyone explain how to resolve this problem?

Thank You,
Raj
-- 
View this message in context: 
http://old.nabble.com/Difference-in-show-and-output-file-tp33893817p33893817.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
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


[Matplotlib-users] Slow imshow when zooming or panning with several synced subplots

2012-05-23 Thread Sergi Pons Freixes
I'm plotting several images at once, sharing axes, because I use it
for exploratory purposes. Each image is the same satellite image at
different dates. I'm experimenting a slow response from matplotlib
when zooming and panning, and I would like to ask for any tips that
could speed up the process.

What I am doing now is:
- Load data from several netcdf files.
- Calculate maximum value of all the data, for normalization.
- Create a grid of subplots using ImageGrid. As each subplot is
generated, I delete the array to free some memory (each array is
stored in a list, the deletion is just a list.pop()). See the code
below.

It's 15 images, single-channel, of 4600x3840 pixels each. I've noticed
that the bottleneck is not the RAM (I have 8 GB), but the processor.
Python spikes to 100% usage on one of the cores when zooming or
panning (it's an Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz, 4 cores, 64
bit).

The code is:
---
import os
import sys

import numpy as np
import netCDF4 as ncdf
import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import ImageGrid
from matplotlib.colors import LogNorm

MIN = 0.001 # Hardcoded minimum data value used in normalization

variable = 'conc_chl'
units = r'$mg/m^3$'
data = []
dates = []

# Get a list of only netCDF files
filelist = os.listdir(sys.argv[1])
filelist = [f for f in filelist if os.path.splitext(f)[1] == '.nc']
filelist.sort()
filelist.reverse()

# Load data and extract dates from filenames
for f in filelist:
dataset = ncdf.Dataset(os.path.join(sys.argv[1],f), 'r')
data.append(dataset.variables[variable][:])
dataset.close()
dates.append((f.split('_')[2][:-3],f.split('_')[1]))

# Get the maximum value of all data. Will be used for normalization
maxc = np.array(data).max()

# Plot the grid of images + dates
fig = plt.figure()
grid = ImageGrid(fig, 111,\
nrows_ncols = (3, 5),\
axes_pad = 0.0,\
share_all=True,\
aspect = False,\
cbar_location = right,\
cbar_mode = single,\
cbar_size = '2.5%',\
)
for g in grid:
v = data.pop()
d = dates.pop()
im = g.imshow(v, interpolation='none', norm=LogNorm(), vmin=MIN, vmax=maxc)
g.text(0.01, 0.01, '-'.join(d), transform = g.transAxes) # Date on a corner
cticks = np.logspace(np.log10(MIN), np.log10(maxc), 5)
cbar = grid.cbar_axes[0].colorbar(im)
cbar.ax.set_yticks(cticks)
cbar.ax.set_yticklabels([str(np.round(t, 2)) for t in cticks])
cbar.set_label_text(units)

# Fine-tune figure; make subplots close to each other and hide x ticks for
# all
fig.subplots_adjust(left=0.02, bottom=0.02, right=0.95, top=0.98,
hspace=0, wspace=0)
grid.axes_llc.set_yticklabels([], visible=False)
grid.axes_llc.set_xticklabels([], visible=False)

plt.show()
---

Any clue about what could be improved to make it more responsive?

PD: This question has been posted previously on Stackoverflow, but it
hasn't got any answer:
http://stackoverflow.com/questions/10635901/slow-imshow-when-zooming-or-panning-with-several-synced-subplots

--
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


[Matplotlib-users] barchart errorbars always in both directions

2012-05-23 Thread Meesters, Aesku.Kipp Institute
Hi,

I'm following the example in the gallery to do a barchart plot (see
http://matplotlib.sourceforge.net/examples/api/barchart_demo.html ).

In contrast to the example I would like to see the error bars only above
the bars, so I tried

rects2 = ax.bar(ind+width, womenMeans, width, color='y',
yerr=stds, error_kw = {'barsabove': True,
   'ecolor'   : 'k'}

While the 'ecolor' argument gets accepted, 'barsabove' apparently has no
effect (error bars still point up and downwards) - yet, no warning /
error is triggered. Where is my mistake? Or is this a bug (still using
version 1.0.1) with a known work-around?

TIA
Chris

--
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


[Matplotlib-users] Resizing a PyQt based mpl window

2012-05-23 Thread Mads Ipsen

Hi,

I have attached a small example displaying a simple plot in a PyQt based 
widget. If you start resizing the widget manually, the labels of the 
axes as well as the title disappear from the plot window even for 
moderately small window sizes.


Any suggestions on how I can fix this?

Best regards,

Mads

--
+-+
| Mads Ipsen  |
+--+--+
| Gåsebæksvej 7, 4. tv |  |
| DK-2500 Valby| phone:  +45-29716388 |
| Denmark  | email:  mads.ip...@gmail.com |
+--+--+


import sys

from PyQt4 import QtGui

from matplotlib.figure import Figure
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg
import matplotlib.backends.qt4_editor.figureoptions as figureoptions

class Plot2D(QtGui.QWidget):

   2D Plot class based on a matplotlib canvas.

def __init__(self, parent=None, testing=False):
# Initialize base class
QtGui.QWidget.__init__(self, parent)

# Set a layout
layout = QtGui.QVBoxLayout()
self.setLayout(layout)

# Widget to hold the canvas
self._plot_widget = QtGui.QWidget()

# Set up figure
self._figure = Figure()
self._canvas = FigureCanvasQTAgg(self._figure)
self._canvas.setParent(self._plot_widget)

# Add widgets to the layout
layout.addWidget(self._canvas)

# Draw somthing
self.axes = self._figure.add_subplot(111)
self.draw()

def draw(self):

   Redraws a figure. Added for unit testing purposes but may also be used for inspiration
   on how to make a plot.

import numpy

str = '1 2 3 4'
data = map(int, str.split())

x = range(len(data))

# clear the axes and redraw the plot anew
self.axes.clear()

self.axes.bar(
left=x,
height=data,
width=8.0/ 100.0,
align='center',
alpha=0.44,
picker=5)

t = numpy.arange(0.0, 3.0, 0.01)
s = numpy.sin(2*numpy.pi*t)
self.axes.plot(t, s, picker=5)
self.axes.set_title('This is a title')
self.axes.set_xlabel('Clock is ticking')
self.axes.set_ylabel('Time is running')

self._canvas.draw()

if __name__ == __main__:
app = QtGui.QApplication(sys.argv)

widget = Plot2D()
widget.show()

sys.exit(app.exec_())
# qApp = QtGui.QApplication(sys.argv)

# aw = ApplicationWindow()
# aw.setWindowTitle(%s % progname)
# aw.show()
# sys.exit(qApp.exec_())
--
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] Slow imshow when zooming or panning with several synced subplots

2012-05-23 Thread Guillaume Gay
Hello


What is the size of a single image file? If they are very big, it is 
better to do everything from processing to ploting at once for each file.



Le 23/05/2012 10:11, Sergi Pons Freixes a écrit :
 I'm plotting several images at once, sharing axes, because I use it
 for exploratory purposes. Each image is the same satellite image at
 different dates. I'm experimenting a slow response from matplotlib
 when zooming and panning, and I would like to ask for any tips that
 could speed up the process.

 What I am doing now is:
  - Load data from several netcdf files.
  - Calculate maximum value of all the data, for normalization.
  - Create a grid of subplots using ImageGrid. As each subplot is
 generated, I delete the array to free some memory (each array is
 stored in a list, the deletion is just a list.pop()). See the code
 below.

 It's 15 images, single-channel, of 4600x3840 pixels each.
This is a lot of data.  8bit or 16bit ?

 I've noticed
 that the bottleneck is not the RAM (I have 8 GB), but the processor.
 Python spikes to 100% usage on one of the cores when zooming or
 panning (it's an Intel(R) Core(TM) i5-2500 CPU @ 3.30GHz, 4 cores, 64
 bit).

 The code is:
 ---
 import os
 import sys

 import numpy as np
 import netCDF4 as ncdf
 import matplotlib.pyplot as plt
 from mpl_toolkits.axes_grid1 import ImageGrid
 from matplotlib.colors import LogNorm

 MIN = 0.001 # Hardcoded minimum data value used in normalization

 variable = 'conc_chl'
 units = r'$mg/m^3$'
 data = []
 dates = []

 # Get a list of only netCDF files
 filelist = os.listdir(sys.argv[1])
 filelist = [f for f in filelist if os.path.splitext(f)[1] == '.nc']
 filelist.sort()
 filelist.reverse()

 # Load data and extract dates from filenames
 for f in filelist:
everything should happen in this loop


  dataset = ncdf.Dataset(os.path.join(sys.argv[1],f), 'r')
  data.append(dataset.variables[variable][:])
instead of creating this big list, use a temporary array (which will be 
overwritten)
  dataset.close()
  dates.append((f.split('_')[2][:-3],f.split('_')[1]))

 # Get the maximum value of all data. Will be used for normalization
 maxc = np.array(data).max()

 # Plot the grid of images + dates
 fig = plt.figure()
 grid = ImageGrid(fig, 111,\
  nrows_ncols = (3, 5),\
  axes_pad = 0.0,\
  share_all=True,\
  aspect = False,\
  cbar_location = right,\
  cbar_mode = single,\
  cbar_size = '2.5%',\
  )
 for g in grid:
  v = data.pop()
  d = dates.pop()
  im = g.imshow(v, interpolation='none', norm=LogNorm(), vmin=MIN, 
 vmax=maxc)
  g.text(0.01, 0.01, '-'.join(d), transform = g.transAxes) # Date on a 
 corner
 cticks = np.logspace(np.log10(MIN), np.log10(maxc), 5)
 cbar = grid.cbar_axes[0].colorbar(im)
 cbar.ax.set_yticks(cticks)
 cbar.ax.set_yticklabels([str(np.round(t, 2)) for t in cticks])
 cbar.set_label_text(units)

 # Fine-tune figure; make subplots close to each other and hide x ticks for
 # all
 fig.subplots_adjust(left=0.02, bottom=0.02, right=0.95, top=0.98,
 hspace=0, wspace=0)
 grid.axes_llc.set_yticklabels([], visible=False)
 grid.axes_llc.set_xticklabels([], visible=False)

 plt.show()
 ---

 Any clue about what could be improved to make it more responsive?

 PD: This question has been posted previously on Stackoverflow, but it
 hasn't got any answer:
 http://stackoverflow.com/questions/10635901/slow-imshow-when-zooming-or-panning-with-several-synced-subplots

 --
 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




--
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] Difference in show and output file

2012-05-23 Thread rajtendulkar

Just in case, if anyone needs the answer, I figured it out.
I used the transData transform in order to draw the lines correctly.

Here is the code - 

# The code below is to add the lines near the tick labels
fig = barGraph.fig
xAxisLim=barGraph.ax.xaxis.get_view_interval()
tickLocArray = barGraph.ax.xaxis.get_majorticklocs()
yStart=-70
yEnd=-0.5
line = Line2D([xAxisLim[0], xAxisLim[0]], 
  [yStart,yEnd],linewidth=2, color='black',
   transform=barGraph.ax.transData)

fig.lines.append(line)

for i in xrange(11):
lnWidth=2
yStartOffset=0
if((i+1)%4 != 0):
lnWidth=1
yStartOffset=20  
xOffset = tickLocArray[i] + (tickLocArray[i+1] - tickLocArray[i])/2
line = Line2D([xOffset, xOffset], 
  [yStart+yStartOffset,yEnd],linewidth=lnWidth, color='black',
   transform=barGraph.ax.transData)  
fig.lines.append(line)

  
line = Line2D([xAxisLim[1], xAxisLim[1]], 
  [yStart,yEnd],linewidth=2, color='black',
   transform=barGraph.ax.transData)

fig.lines.append(line)

plt.figtext(0.247, 0.05, '1')
plt.figtext(0.523, 0.05, '2')
plt.figtext(0.797, 0.05, '4')


Thank You!
Raj


rajtendulkar wrote:
 
 Dear All,
 
 I am trying to write a program in matplotlib to generate stacked bar
 graphs.
 My problem is that the commands -  plt.show() and
 self.fig.savefig(fileName) generate different outputs.
 I tried different output formats like PDF, PNG, EPS. But the problem
 remains the same.
 This happens for the lines that I am trying to draw outside the plot.
 I am trying to draw vertical lines between xticklabels.
 I have uploaded the data file and the code file.
  http://old.nabble.com/file/p33893817/data.dat data.dat 
  http://old.nabble.com/file/p33893817/matplot1.py matplot1.py 
 Could anyone explain how to resolve this problem?
 
 Thank You,
 Raj
 

-- 
View this message in context: 
http://old.nabble.com/Difference-in-show-and-output-file-tp33893817p33894599.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
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


[Matplotlib-users] TypeError: coercing to Unicode: need string or buffer, dict found

2012-05-23 Thread Waléria Antunes David
Hi,

Anyone know how to solve this error?

Exception Type: TypeError Exception Value: coercing to Unicode: need string
or buffer, dict found

Can you help me??

See mycode: http://dpaste.com/751460/

And see my Traceback: http://dpaste.com/750773/


Thanks,
--
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] TypeError: coercing to Unicode: need string or buffer, dict found

2012-05-23 Thread Michael Droettboom
It's a long shot, but have you tried removing the font cache in 
~/.matplotlib/fontList.cache?  What version of matplotlib are you using?


Mike

On 05/23/2012 08:16 AM, Waléria Antunes David wrote:

Hi,

Anyone know how to solve this error?

Exception Type: TypeError Exception Value: coercing to Unicode: need 
string or buffer, dict found


Can you help me??

See mycode: http://dpaste.com/751460/

And see my Traceback: http://dpaste.com/750773/


Thanks,




--
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


--
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] barchart errorbars always in both directions

2012-05-23 Thread Benjamin Root
On Wed, May 23, 2012 at 4:03 AM, Meesters, Aesku.Kipp Institute 
meest...@aesku-kipp.com wrote:

 Hi,

 I'm following the example in the gallery to do a barchart plot (see
 http://matplotlib.sourceforge.net/examples/api/barchart_demo.html ).

 In contrast to the example I would like to see the error bars only above
 the bars, so I tried

 rects2 = ax.bar(ind+width, womenMeans, width, color='y',
yerr=stds, error_kw = {'barsabove': True,
   'ecolor'   : 'k'}

 While the 'ecolor' argument gets accepted, 'barsabove' apparently has no
 effect (error bars still point up and downwards) - yet, no warning /
 error is triggered. Where is my mistake? Or is this a bug (still using
 version 1.0.1) with a known work-around?

 TIA
 Chris


Chris,

I don't think barsabove does what you want.  By above, it means that
the errorbar is plotted in a layer on top of the plotting symbol rather
than in the layer under it.  Both ends will be plotted.

To get what you want, you might want to try (Note: untested):

rects2 = ax.bar(ind+width, womenMeans, width, color='y',
   yerr=np.vstack([[0]*len(stds), stds]), error_kw = {'ecolor'
  : 'k'})

When yerr is a 2xN numpy array, errorbars are plotted at y-yerr[0, :] and
y+yerr[1,:]. So, np.vstack creates a 2xN array where the first row is all
zeros and the second row is the stds values.

I hope that works for you!
Ben Root
--
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] Slow imshow when zooming or panning with several synced subplots

2012-05-23 Thread Sergi Pons Freixes
On Wed, May 23, 2012 at 11:00 AM, Guillaume Gay
guilla...@mitotic-machine.org wrote:
 Hello


 What is the size of a single image file? If they are very big, it is
 better to do everything from processing to ploting at once for each file.

As stated below, each image is single-channel, of 4600x3840 pixels. As
you can see on the code, there is not much processing, just loading
the images and plotting them. What it's slow is not the execution of
the code, is the interactive zooming and panning once the plots are
in the screen.

 It's 15 images, single-channel, of 4600x3840 pixels each.
 This is a lot of data.  8bit or 16bit ?

They are floating point values (for example, from 0 to 45.xxx). If I
understood correctly, setting the vmin and vmax, matplotlib should
normalize the values to an appropriate number of bits.

 for f in filelist:
 everything should happen in this loop

      dataset = ncdf.Dataset(os.path.join(sys.argv[1],f), 'r')
      data.append(dataset.variables[variable][:])
 instead of creating this big list, use a temporary array (which will be
 overwritten)
      dataset.close()
      dates.append((f.split('_')[2][:-3],f.split('_')[1]))

Why? It's true that this way at the beginning it eats a lot of RAM,
but then it is released after each pop() (and calculating the maximum
of all the data without plotting is needed to use the same
normalization level on all the plots). Anyway, the slowness ocurrs
during the interaction of the plot, not during the execution of the
code.

--
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] barchart errorbars always in both directions

2012-05-23 Thread Meesters, Aesku.Kipp Institute
Thanks, Ben. This is indeed what I was looking for and gives the desired
behavior.

Thanks a lot!
Chris

On Wed, 2012-05-23 at 08:55 -0400, Benjamin Root wrote:
 
 On Wed, May 23, 2012 at 4:03 AM, Meesters, Aesku.Kipp Institute
 meest...@aesku-kipp.com wrote:
 Hi,
 
 I'm following the example in the gallery to do a barchart plot
 (see
 http://matplotlib.sourceforge.net/examples/api/barchart_demo.html ).
 
 In contrast to the example I would like to see the error bars
 only above
 the bars, so I tried
 
 rects2 = ax.bar(ind+width, womenMeans, width, color='y',
yerr=stds, error_kw = {'barsabove': True,
   'ecolor'   : 'k'}
 
 While the 'ecolor' argument gets accepted, 'barsabove'
 apparently has no
 effect (error bars still point up and downwards) - yet, no
 warning /
 error is triggered. Where is my mistake? Or is this a bug
 (still using
 version 1.0.1) with a known work-around?
 
 TIA
 Chris
 
 
 Chris,
 
 I don't think barsabove does what you want.  By above, it means
 that the errorbar is plotted in a layer on top of the plotting symbol
 rather than in the layer under it.  Both ends will be plotted.
 
 To get what you want, you might want to try (Note: untested):
 
 rects2 = ax.bar(ind+width, womenMeans, width, color='y',
yerr=np.vstack([[0]*len(stds), stds]), error_kw =
 {'ecolor'   : 'k'})
 
 When yerr is a 2xN numpy array, errorbars are plotted at y-yerr[0, :]
 and y+yerr[1,:]. So, np.vstack creates a 2xN array where the first row
 is all zeros and the second row is the stds values.
 
 I hope that works for you!
 Ben Root
 
 

--
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] Slow imshow when zooming or panning with several synced subplots

2012-05-23 Thread Guillaume Gay
Le 23/05/2012 15:04, Sergi Pons Freixes a écrit :
 On Wed, May 23, 2012 at 11:00 AM, Guillaume Gay
 guilla...@mitotic-machine.org  wrote:
 Hello


 What is the size of a single image file? If they are very big, it is
 better to do everything from processing to ploting at once for each file.
 As stated below, each image is single-channel, of 4600x3840 pixels. As
 you can see on the code, there is not much processing, just loading
 the images and plotting them. What it's slow is not the execution of
 the code, is the interactive zooming and panning once the plots are
 in the screen.

 It's 15 images, single-channel, of 4600x3840 pixels each.
 This is a lot of data.  8bit or 16bit ?
 They are floating point values (for example, from 0 to 45.xxx). If I
 understood correctly, setting the vmin and vmax, matplotlib should
 normalize the values to an appropriate number of bits.

 for f in filelist:
 everything should happen in this loop

   dataset = ncdf.Dataset(os.path.join(sys.argv[1],f), 'r')
   data.append(dataset.variables[variable][:])
 instead of creating this big list, use a temporary array (which will be
 overwritten)
   dataset.close()
   dates.append((f.split('_')[2][:-3],f.split('_')[1]))
 Why? It's true that this way at the beginning it eats a lot of RAM,
 but then it is released after each pop()
oh I didn't see the pop()...

So now then I don't know...

Do you have to show them full-scale? Maybe you can just use thumbnails 
of sort?

G.

 (and calculating the maximum
 of all the data without plotting is needed to use the same
 normalization level on all the plots). Anyway, the slowness ocurrs
 during the interaction of the plot, not during the execution of the
 code.

 --
 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




--
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] how to set figure to appear on another monitor?

2012-05-23 Thread Gökhan Sever
On Wed, May 23, 2012 at 8:32 AM, Chao YUE chaoyue...@gmail.com wrote:

 Dear all,

 I have two different monitors. How can I use plot command within terminal
 in this monitor and set the figure to show defaultly in another one?

 thanks,

 Chao


Hello,

I have a similar question posted on SO -
http://stackoverflow.com/questions/7802366/matplotlib-window-layout-questions

With few extra commands you can get your figures appearing on your second
monitor. However, SetPosition behavior is somewhat unpredictable. When I
pass a large x value it tendsmove the figure to my second monitor. What
would be nice is to mpl to remember the last window position and size --say
for instance for particular plots I always want to view figures in
maximized window and placed on the second monitor.


-- 
Gökhan
--
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] Matplotlib-users Digest, Vol 72, Issue 25

2012-05-23 Thread Waléria Antunes David
Hi Mike,

About this question: TypeError: coercing to Unicode: need string or buffer,
dict found

The version of matplotlib that i'm using is matplotlib-0.99.1-py2.6

And how do I remove the font cache in ~ / .matplotlib / fontList.cache

My Operating System is Windows.

Thanks,

On Wed, May 23, 2012 at 11:15 AM, 
matplotlib-users-requ...@lists.sourceforge.net wrote:

 Send Matplotlib-users mailing list submissions to
matplotlib-users@lists.sourceforge.net

 To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/matplotlib-users
 or, via email, send a message with subject or body 'help' to
matplotlib-users-requ...@lists.sourceforge.net

 You can reach the person managing the list at
matplotlib-users-ow...@lists.sourceforge.net

 When replying, please edit your Subject line so it is more specific
 than Re: Contents of Matplotlib-users digest...


 Today's Topics:

   1. Re: Difference in show and output file (rajtendulkar)
   2. TypeError: coercing to Unicode: need string orbuffer, dict
  found (Wal?ria Antunes David)
   3. Re: TypeError: coercing to Unicode: need string or buffer,
  dict found (Michael Droettboom)
   4. Re: barchart errorbars always in both directions (Benjamin Root)
   5. Re: Slow imshow when zooming or panning with several synced
  subplots (Sergi Pons Freixes)
   6. Re: barchart errorbars always in both directions
  (Meesters, Aesku.Kipp Institute)


 --

 Message: 1
 Date: Wed, 23 May 2012 02:49:05 -0700 (PDT)
 From: rajtendulkar pranav.tendul...@gmail.com
 Subject: Re: [Matplotlib-users] Difference in show and output file
 To: matplotlib-users@lists.sourceforge.net
 Message-ID: 33894599.p...@talk.nabble.com
 Content-Type: text/plain; charset=us-ascii


 Just in case, if anyone needs the answer, I figured it out.
 I used the transData transform in order to draw the lines correctly.

 Here is the code -

 # The code below is to add the lines near the tick labels
 fig = barGraph.fig
 xAxisLim=barGraph.ax.xaxis.get_view_interval()
 tickLocArray = barGraph.ax.xaxis.get_majorticklocs()
 yStart=-70
 yEnd=-0.5
 line = Line2D([xAxisLim[0], xAxisLim[0]],
  [yStart,yEnd],linewidth=2, color='black',
   transform=barGraph.ax.transData)

 fig.lines.append(line)

 for i in xrange(11):
lnWidth=2
yStartOffset=0
if((i+1)%4 != 0):
lnWidth=1
yStartOffset=20
xOffset = tickLocArray[i] + (tickLocArray[i+1] - tickLocArray[i])/2
line = Line2D([xOffset, xOffset],
  [yStart+yStartOffset,yEnd],linewidth=lnWidth, color='black',
   transform=barGraph.ax.transData)
fig.lines.append(line)


 line = Line2D([xAxisLim[1], xAxisLim[1]],
  [yStart,yEnd],linewidth=2, color='black',
   transform=barGraph.ax.transData)

 fig.lines.append(line)

 plt.figtext(0.247, 0.05, '1')
 plt.figtext(0.523, 0.05, '2')
 plt.figtext(0.797, 0.05, '4')


 Thank You!
 Raj


 rajtendulkar wrote:
 
  Dear All,
 
  I am trying to write a program in matplotlib to generate stacked bar
  graphs.
  My problem is that the commands -  plt.show() and
  self.fig.savefig(fileName) generate different outputs.
  I tried different output formats like PDF, PNG, EPS. But the problem
  remains the same.
  This happens for the lines that I am trying to draw outside the plot.
  I am trying to draw vertical lines between xticklabels.
  I have uploaded the data file and the code file.
   http://old.nabble.com/file/p33893817/data.dat data.dat
   http://old.nabble.com/file/p33893817/matplot1.py matplot1.py
  Could anyone explain how to resolve this problem?
 
  Thank You,
  Raj
 

 --
 View this message in context:
 http://old.nabble.com/Difference-in-show-and-output-file-tp33893817p33894599.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.




 --

 Message: 2
 Date: Wed, 23 May 2012 09:16:09 -0300
 From: Wal?ria Antunes David waleriantu...@gmail.com
 Subject: [Matplotlib-users] TypeError: coercing to Unicode: need
string or   buffer, dict found
 To: Matplotlib Users matplotlib-users@lists.sourceforge.net
 Message-ID:
CAEwvc_uK2icxVBzF5Aykka-_Mig4EoCNovgt2jPJHT=xqdv...@mail.gmail.com
 
 Content-Type: text/plain; charset=iso-8859-1

 Hi,

 Anyone know how to solve this error?

 Exception Type: TypeError Exception Value: coercing to Unicode: need string
 or buffer, dict found

 Can you help me??

 See mycode: http://dpaste.com/751460/

 And see my Traceback: http://dpaste.com/750773/


 Thanks,
 -- next part --
 An HTML attachment was scrubbed...

 --

 Message: 3
 Date: Wed, 23 May 2012 08:29:48 -0400
 From: Michael Droettboom md...@stsci.edu
 Subject: Re: [Matplotlib-users] TypeError: coercing to Unicode: need
string or buffer, dict found
 To: 

Re: [Matplotlib-users] Slow imshow when zooming or panning with several synced subplots

2012-05-23 Thread Tony Yu
On Wed, May 23, 2012 at 9:04 AM, Sergi Pons Freixes
sponsfrei...@gmail.comwrote:

 On Wed, May 23, 2012 at 11:00 AM, Guillaume Gay
 guilla...@mitotic-machine.org wrote:
  Hello
 
 
  What is the size of a single image file? If they are very big, it is
  better to do everything from processing to ploting at once for each file.

 As stated below, each image is single-channel, of 4600x3840 pixels. As
 you can see on the code, there is not much processing, just loading
 the images and plotting them. What it's slow is not the execution of
 the code, is the interactive zooming and panning once the plots are
 in the screen.

  It's 15 images, single-channel, of 4600x3840 pixels each.
  This is a lot of data.  8bit or 16bit ?

 They are floating point values (for example, from 0 to 45.xxx). If I
 understood correctly, setting the vmin and vmax, matplotlib should
 normalize the values to an appropriate number of bits.


I'm not sure what you mean by normalize the values to an appropriate
number of bits, but I don't think setting `vmin` or `vmax` will change the
data type of the image. So if you have 64-bit floating point images (100+
Mb per image), then that's what you're going to be moving/scaling when you
pan and zoom.

-Tony
--
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] Turning of ticks in matplotlibrc

2012-05-23 Thread Tony Yu
On Mon, May 21, 2012 at 4:01 PM, Andreas Mueller
amuel...@ais.uni-bonn.dewrote:

 **
 Hi everybody.
 I have been trying to turn off xticks and yticks and their labels in
 matplotlibrc.
 Tickshttp://matplotlib.sourceforge.net/api/axis_api.html#matplotlib.axis.Tickhave
  an argument tick1On and label1On but it seems I can not use these
 in the config file. Is that correct?
 Is there any other way to turn of ticks by default?

 Thanks,
 Andy

 Hi Andy,

I don't think there are any rc parameters for controlling this, but you can
call `plt.axis('off')` or `ax.set_axis_off()`. I know that's not what you
were looking for, but I thought I'd mention it.

Best,
-Tony
--
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] how to set figure to appear on another monitor?

2012-05-23 Thread Benjamin Root
On Wednesday, May 23, 2012, Gökhan Sever wrote:


 On Wed, May 23, 2012 at 8:32 AM, Chao YUE 
 chaoyue...@gmail.comjavascript:_e({}, 'cvml', 'chaoyue...@gmail.com');
  wrote:

 Dear all,

 I have two different monitors. How can I use plot command within terminal
 in this monitor and set the figure to show defaultly in another one?

 thanks,

 Chao


 Hello,

 I have a similar question posted on SO -
 http://stackoverflow.com/questions/7802366/matplotlib-window-layout-questions

 With few extra commands you can get your figures appearing on your second
 monitor. However, SetPosition behavior is somewhat unpredictable. When I
 pass a large x value it tendsmove the figure to my second monitor. What
 would be nice is to mpl to remember the last window position and size --say
 for instance for particular plots I always want to view figures in
 maximized window and placed on the second monitor.




This is more an issue with how the GUI toolkit interacts with the desktop
manager. I think there are some existing PRs (or at least wishlist items)
for supplying additional data down to the figure object. The person who did
that feature was then going to set a windowing rule of some sort for his
window manager to handle mpl figures specially.

As far as I know, the feature never got added. Maybe someone else could
resurrect that work?

Cheers!
Ben Root


--
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


[Matplotlib-users] (no subject)

2012-05-23 Thread Arek Kedzior
http://paulaslominska.cba.pl/lnjysgcpta/395506.html--
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