[Matplotlib-users] lines with fixed pixel thickness

2011-08-01 Thread Mátyás János
Dear users,

I would like to draw lines with fixed pixel thickness, for example 1,
2, or 3 pixels, which remains 1 pixel, even if I zoom in and out the
graph in my interactive application. How can I do this with matplotlib?

I tried to set linewidth to 1 on creating LineCollection, but this
creates too thick lines. If I set it to 0.25 or 0.1, for example, then
some lines on the screen are thin, but some line instances are
simply missing (not visible), depending on the zoom.


Thank you for your help,

János

--
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] plot with discontinuous x-axis

2011-08-01 Thread denoise

Hi there,

i'd like to plot a data series with signal values over timestamps, what
works perfectly. But if I want to display 2 series with different time
domains, theres a gap in between.
For example my first set of data is from time (x) 1-3 and the second from
7-8. If I send the mixed array to the plot, I will receive something like
that:
 
y|x x x x x x 
x| 0 1 2 3 4 5 6 7 8 9 10 11

But if there is considerably more time between the to data sets, it soon
will look confusing.
What i need is a graph over this:

y| x x x   x x x 
x| 1 2 3  7 8 9

Of course I could do this with 2 subplots, but i want to scroll over a whole
set of data.
Is it possible wih matplotlib, or is there a workaround?

Thanks!
Hubert 

-- 
View this message in context: 
http://old.nabble.com/plot-with-discontinuous-x-axis-tp32155499p32155499.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


--
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plot with discontinuous x-axis

2011-08-01 Thread Warren Weckesser
On Thu, Jul 28, 2011 at 5:41 AM, denoise hubert.g...@partner.bmw.de wrote:

 Hi there,

 i'd like to plot a data series with signal values over timestamps, what
 works perfectly. But if I want to display 2 series with different time
 domains, theres a gap in between.
 For example my first set of data is from time (x) 1-3 and the second from
 7-8. If I send the mixed array to the plot, I will receive something like
 that:

 y|    x x x         x x x
 x| 0 1 2 3 4 5 6 7 8 9 10 11

 But if there is considerably more time between the to data sets, it soon
 will look confusing.
 What i need is a graph over this:

 y| x x x   x x x
 x| 1 2 3  7 8 9

 Of course I could do this with 2 subplots, but i want to scroll over a whole
 set of data.
 Is it possible wih matplotlib, or is there a workaround?


There are a couple examples here:

http://stackoverflow.com/questions/5656798/python-matplotlib-is-there-a-way-to-make-a-discontinuous-axis


Warren




 Thanks!
 Hubert

 --
 View this message in context: 
 http://old.nabble.com/plot-with-discontinuous-x-axis-tp32155499p32155499.html
 Sent from the matplotlib - users mailing list archive at Nabble.com.


 --
 Got Input?   Slashdot Needs You.
 Take our quick survey online.  Come on, we don't ask for help often.
 Plus, you'll get a chance to win $100 to spend on ThinkGeek.
 http://p.sf.net/sfu/slashdot-survey
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


--
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] how can i use utf-8 or just how can i plot the datetime in local settings ?

2011-08-01 Thread Michael Droettboom
This is a bug in that matplotlib is not reading the preferred encoding 
correctly, because doing so has undesired side effects in some cases.  
An easy workaround is to add the following to the top of your script 
(before importing matplotlib):

import locale
locale.setlocale(locale.LC_ALL, '')

Note, you will also need to select a font that has Cyrillic characters.  
The default font shipped with matplotlib Vera Sans does not, but you 
can use its more-Unicode-complete sibling DejaVu Sans (installed on 
most Linux systems by default).

Interestingly, another use had a similar problem quite recently.  The 
following branch of matplotlib may also fix your problem:

https://github.com/mdboom/matplotlib/tree/locale_formatting

To test this, you would need to build it from source, and then set the 
rcParam axes.formatter.use_locale to True.

Cheers,
Mike

On 08/01/2011 12:23 AM, Alexey Uimanov wrote:
 Here the code
 #!/usr/bin/env python

 from pylab import figure, show
 from matplotlib.dates import AutoDateLocator, AutoDateFormatter,
 drange, DateFormatter
 import datetime
 import random

 dates = drange(datetime.datetime(2010, 1, 1), datetime.datetime(2010,
 12,31), datetime.timedelta(days = 1))
 opens = map(lambda a: random.random(), dates)

 fig = figure()
 ax = fig.add_subplot(111)
 ax.plot_date(dates, opens, '-')

 majloc = AutoDateLocator()
 majform = AutoDateFormatter(majloc)

 ax.xaxis.set_major_locator(majloc)
 ax.xaxis.set_major_formatter(majform)
 ax.autoscale_view()
 ax.grid(True)
 fig.autofmt_xdate()
 show()
 
 It is just the same code as date_demo1.py from examples directory with
 some modifications
 My current locale is ru_RU.UTF-8 and i want plot the date ruller along
 X axis in format of my locale, with russian names of months.
 I can not do this because of this error when printing the chart
 Traceback (most recent call last):
File /usr/lib/python2.7/site-packages/matplotlib/backends/backend_gtk.py,
 line 394, in expose_event
  self._render_figure(self._pixmap, w, h)
File 
 /usr/lib/python2.7/site-packages/matplotlib/backends/backend_gtkagg.py,
 line 75, in _render_figure
  FigureCanvasAgg.draw(self)
File /usr/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py,
 line 394, in draw
  self.figure.draw(self.renderer)
File /usr/lib/python2.7/site-packages/matplotlib/artist.py, line
 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
File /usr/lib/python2.7/site-packages/matplotlib/figure.py, line
 798, in draw
  func(*args)
File /usr/lib/python2.7/site-packages/matplotlib/artist.py, line
 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
File /usr/lib/python2.7/site-packages/matplotlib/axes.py, line 1946, in 
 draw
  a.draw(renderer)
File /usr/lib/python2.7/site-packages/matplotlib/artist.py, line
 55, in draw_wrapper
  draw(artist, renderer, *args, **kwargs)
File /usr/lib/python2.7/site-packages/matplotlib/axis.py, line 971, in 
 draw
  tick_tups = [ t for t in self.iter_ticks()]
File /usr/lib/python2.7/site-packages/matplotlib/axis.py, line
 907, in iter_ticks
  majorLabels = [self.major.formatter(val, i) for i, val in
 enumerate(majorLocs)]
File /usr/lib/python2.7/site-packages/matplotlib/dates.py, line
 486, in __call__
  return self._formatter(x, pos)
File /usr/lib/python2.7/site-packages/matplotlib/dates.py, line
 336, in __call__
  return self.strftime(dt, self.fmt)
File /usr/lib/python2.7/site-packages/matplotlib/dates.py, line
 362, in strftime
  return cbook.unicode_safe(dt.strftime(fmt))
File /usr/lib/python2.7/site-packages/matplotlib/cbook.py, line
 41, in unicode_safe
  else: return unicode(s, preferredencoding)
 UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position
 0: ordinal not in range(128)
 
 When lauching this with LANG=C everythig works but datetime prints in
 english locale.
 Version of matplotlib is 1.0.1
 What am i doing wrong ?

 --
 Got Input?   Slashdot Needs You.
 Take our quick survey online.  Come on, we don't ask for help often.
 Plus, you'll get a chance to win $100 to spend on ThinkGeek.
 http://p.sf.net/sfu/slashdot-survey
 ___
 Matplotlib-users mailing list
 Matplotlib-users@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-- 
Michael Droettboom
Science Software Branch
Space Telescope Science Institute
Baltimore, Maryland, USA


--
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net

Re: [Matplotlib-users] lines with fixed pixel thickness

2011-08-01 Thread Benjamin Root
On Fri, Jul 29, 2011 at 4:51 PM, Mátyás János mjan...@gmail.com wrote:

 Dear users,

 I would like to draw lines with fixed pixel thickness, for example 1,
 2, or 3 pixels, which remains 1 pixel, even if I zoom in and out the
 graph in my interactive application. How can I do this with matplotlib?

 I tried to set linewidth to 1 on creating LineCollection, but this
 creates too thick lines. If I set it to 0.25 or 0.1, for example, then
 some lines on the screen are thin, but some line instances are
 simply missing (not visible), depending on the zoom.


 Thank you for your help,

 János


Janos,

This sounds like some bugs that may have been fixed at some point.  Which
version of matplotlib are you using, and which backend?

Ben Root
--
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Autoscaling after removing lines.

2011-08-01 Thread Goyo
Hy all,

I recently had a pretty hard time trying to figure out how to properly
autoscale a plot after removing a line (see attached script). Finally
I found at [1] that I have to explicitly refresh the axes dataLim
before autoscaling.

In [1] John Hunter says that computing the proper dataLim can be
complicated if there are several types of artists in the axes, like
polygons and collections an that [it] would be useful to have an Axes
method like auto_datalim to for the datalim to readjust to all the
current data.

My question is whether such a function has been implemented. Besides
any suggestions about how to deal with this are welcome. I just need
to adjust to lines right now but this may change in the future.

Best regards

Goyo

[1] http://old.nabble.com/Removing-a-line-from-a-plot-td7249600.html


autoscaling_issues.py
Description: Binary data
--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos  much more. Register early  save!
http://p.sf.net/sfu/rim-blackberry-1___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] close gtk2 figure without main_quit() call

2011-08-01 Thread Alexey Uimanov
I am writing gtk2 application on python, I need to plot a chart in
separate window and i just use this code

def matplot_print(self, print_values):
\brief print data by matplotlib and shw the figure
\param print_values [(name - is a string, [(datetime, value)]
- is a list of data to plot)] - list of charts to plot

fig = plt.figure()
ax = fig.add_subplot(111)
names = map(lambda a: a[0], print_values)
lines  = map(lambda chart: ax.plot_date(map(lambda chd:
chd[0], chart[1]),
map(lambda chy:
chy[1], chart[1]), '-'), print_values)
plt.figlegend(lines, names, 'upper left')

majloc = AutoDateLocator()
majform = AutoDateFormatter(majloc)
ax.xaxis.set_major_locator(majloc)
ax.xaxis.set_major_formatter(majform)
ax.autoscale_view()
ax.grid(True)
fig.autofmt_xdate()
fig.show()

The figure is showing and everything works before closing the window
of figure. It seems that figure call gtk.main_quit() when closing it's
window. How to override this behaviour ?

--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos  much more. Register early  save!
http://p.sf.net/sfu/rim-blackberry-1
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] Matlab-like Cursor Mode

2011-08-01 Thread Tudor Vinereanu
Hi All,

Something I use a lot in Matlab is probing points from a plot, basically
clicking to select the nearest point and show a tooltip with the x and y
values. I didn't manage to reproduce this exactly with matplotlib, but I
found the code from the link below which is close enough to what I need:

http://stackoverflow.com/questions/4652439/is-there-a-matplotlib-equivalent-of-matlabs-datacursormode

Is there a better way, or something along those lines is the best option?

Thanks in advance,
Tudor

--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos  much more. Register early  save!
http://p.sf.net/sfu/rim-blackberry-1
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] plot with discontinuous x-axis

2011-08-01 Thread Paul Ivanov
Warren Weckesser, on 2011-08-01 09:49,  wrote:
 There are a couple examples here:
 
 http://stackoverflow.com/questions/5656798/python-matplotlib-is-there-a-way-to-make-a-discontinuous-axis

I was going to say: 

Damn those stackoverflow cool kids, reinventing the wheel when we
already have an example for this in git:
https://github.com/matplotlib/matplotlib/blob/master/examples/pylab_examples/broken_axis.py

but now I see that's exactly the example that's the top answer,
there, heh.

best,
-- 
Paul Ivanov
314 address only used for lists,  off-list direct email at:
http://pirsquared.org | GPG/PGP key id: 0x0F3E28F7 


signature.asc
Description: Digital signature
--
BlackBerryreg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos  much more. Register early  save!
http://p.sf.net/sfu/rim-blackberry-1___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users